From patchwork Thu Jul 15 02:32:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Manz X-Patchwork-Id: 12378293 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C1CFC1B08C for ; Thu, 15 Jul 2021 02:32:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 64305613D2 for ; Thu, 15 Jul 2021 02:32:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236304AbhGOCf3 (ORCPT ); Wed, 14 Jul 2021 22:35:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230256AbhGOCf2 (ORCPT ); Wed, 14 Jul 2021 22:35:28 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1364C06175F for ; Wed, 14 Jul 2021 19:32:34 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id v5so5640491wrt.3 for ; Wed, 14 Jul 2021 19:32:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=cBXAr4C9PhS8HT7XeRkrKFLUcx/iLJNZS1aFIEbfMs4=; b=eAmNir1nQGLrJU0ZlHGRPImMWJsTMhbHQdYM9r4HcnPteyeqfBnThCkiD6IiMEf57a D6iUhHPoHdCheB9m91aNmSWSufXl+DjRZj5r070GeSoYwzivtVxfB8wjGJnDlP1E4Esu sHGmri1+Pg/KfS6tL4mWHnkEtPULdTVGI9uWH0kYVXPdK4C1toKYZskyQtghUlZKKBi6 fDdD3jhArY/4BHbaNNdjuQV5vUidJjpiiWhiBShBACqnggQcXUgNPByWrQSnNwzvSoyg BqHF4WKSXQwhW0kezNNz/H69Vz/2ZFgTeON5qEnA+TxgbFPgR9mtPW8adEgA2T5CWW/f jsrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=cBXAr4C9PhS8HT7XeRkrKFLUcx/iLJNZS1aFIEbfMs4=; b=QztDPFeIvm/u2UX+db38YJnBTvXT7Dyvi4SnxxejO2huhoQuxJdBo8gCAtMDNHAvPd OgFmxiY1RQZ8TEUH9PGvyPY9zqPivN7cwBsEjlXYrTvl/zxF4pJyOnklMwkgkia3kdMz Z0ATS1aObO2h93C558M5pdcyQVOu+7rYXiTPmo5kJEVWyiK63can9TfbdSl7Pw3zviHp uB2mQ1F6fErrkC+6ls8VpyH+tpgjzmauZiC0DKOudmbtYZSKQzwBpxvI33bC4npoVO7+ yven1BHXBsZQrbo7hTXKUgdq6kA7jAyDnKOKVxxOSqj1uTjIknGP6kWKOARflq8r3bz2 a23Q== X-Gm-Message-State: AOAM5322OKs73Q7A9iRvRsQ/CorpL5bM/eyPb9eeOJUJZFrPFzkvS58m K1gxaT2XQKDZrHZn/1ZixC3etZ4aC5s= X-Google-Smtp-Source: ABdhPJyMA3TST0BOWsgoGIbzAFJvKgO7MV8SmMu0LsSr8S6CzINpat9VDHTqiGkhiyH4prk5BrvEnA== X-Received: by 2002:adf:edc8:: with SMTP id v8mr1657633wro.279.1626316353320; Wed, 14 Jul 2021 19:32:33 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id f130sm4346770wmf.23.2021.07.14.19.32.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jul 2021 19:32:32 -0700 (PDT) Message-Id: <5618933279dadf48ba51b79fc11beec8c163820e.1626316350.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Thu, 15 Jul 2021 02:32:28 +0000 Subject: [PATCH v4 1/3] t2400: clean up '"add" worktree with lock' test Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Eric Sunshine , Stephen Manz , Stephen Manz Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Stephen Manz From: Stephen Manz - remove unneeded `git rev-parse` which must have come from a copy-paste of another test - unlock the worktree with test_when_finished Signed-off-by: Stephen Manz --- t/t2400-worktree-add.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t2400-worktree-add.sh b/t/t2400-worktree-add.sh index 96dfca15542..93d3795cab9 100755 --- a/t/t2400-worktree-add.sh +++ b/t/t2400-worktree-add.sh @@ -67,8 +67,8 @@ test_expect_success '"add" worktree' ' ' test_expect_success '"add" worktree with lock' ' - git rev-parse HEAD >expect && git worktree add --detach --lock here-with-lock main && + test_when_finished "git worktree unlock here-with-lock || :" && test -f .git/worktrees/here-with-lock/locked ' From patchwork Thu Jul 15 02:32:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Manz X-Patchwork-Id: 12378295 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C85FDC47E48 for ; Thu, 15 Jul 2021 02:32:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B2816613CF for ; Thu, 15 Jul 2021 02:32:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236346AbhGOCf3 (ORCPT ); Wed, 14 Jul 2021 22:35:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232855AbhGOCf2 (ORCPT ); Wed, 14 Jul 2021 22:35:28 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3ABE0C061760 for ; Wed, 14 Jul 2021 19:32:35 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id d12so5583978wre.13 for ; Wed, 14 Jul 2021 19:32:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=doNO/H+yymBmP9CMLggZFqCEhgObOPJu7vNmhKmj97g=; b=f1yBHXblUFt4lB+x8rD3F6Hbb5PLAvT4w7GtAnpwr9F5wFQmosq7yjKHimk8ZxwvHi lpGAvHw0vF4VRbgPcsBWKw9TVoDk1//nD4yS6hZUcsR7Z3KCn4O3fPkilpoZNsPxxuOw rlIlZT+LrVNZjL4+Bzem1G5VRKdZwWmd6tnAVMaFU/CA8gXEKU5udbZUf/DVK+BLBnOX cSzyiQ0a5hdAUvSnzsRJ6PGn0Uc85698qkXoKtUnL/yKMwk0kwbASYK9Brl+OGMmxtEi ufwje0PHk9vaDv3owNAzhTrbJaTcvZtVbk8NhBDb1dqE335XXRtI47qTy5KESiZjOE1C alTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=doNO/H+yymBmP9CMLggZFqCEhgObOPJu7vNmhKmj97g=; b=aoAJ5FsFRshi8GEd5oLkH1aDFTI/nESESRPjOetXJ2mQ65s4QH/qOigCOxd7i2JhSc EjX48dIHynDXPpp5TolxJhly1nQLkW1GeR36M1MhCC1dn5YIs/qXvedUXIzs2i0lIiCV JORLwbW8PkkGKPUFu6xf+Ee37IZqMy0Rlv8S7ogfTv6Fhi9azm39w5T6Eoj+TPAIYXf4 xdrEebQizwolsXGy2idUaREpQBFcPrx205q4ptMUaM4lXmyJHfg+J0P20QIDTRyhCOpq K4jdXC+nxJhj7cerj8ZEekTOnef0FNCvbDDGbI3aJSgLTjn0crl3JEVENWZ0tcRnsX/i IhCA== X-Gm-Message-State: AOAM531OW/937O8fIc9Nys9lJskuaTQTLfsYChZOGrPZjYYrvpXLKsId Fr2RzTbsW99KPDbl6JztHTGnkpb1tk4= X-Google-Smtp-Source: ABdhPJz7APB2OrTRrqK91BkIzzawozhFRnsmCJ5PscHfuEjXHqiCzLZX6qaAKrHz+OwZ6oIt6b8m/A== X-Received: by 2002:a5d:4e4d:: with SMTP id r13mr1723829wrt.224.1626316353904; Wed, 14 Jul 2021 19:32:33 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id l14sm4348295wrs.22.2021.07.14.19.32.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jul 2021 19:32:33 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Thu, 15 Jul 2021 02:32:29 +0000 Subject: [PATCH v4 2/3] worktree: mark lock strings with `_()` for translation Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Eric Sunshine , Stephen Manz , Stephen Manz Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Stephen Manz From: Stephen Manz - default lock string, "added with --lock" - temporary lock string, "initializing" Signed-off-by: Stephen Manz --- builtin/worktree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/worktree.c b/builtin/worktree.c index 976bf8ed063..4829b9507ff 100644 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@ -303,9 +303,9 @@ static int add_worktree(const char *path, const char *refname, */ strbuf_addf(&sb, "%s/locked", sb_repo.buf); if (!opts->keep_locked) - write_file(sb.buf, "initializing"); + write_file(sb.buf, _("initializing")); else - write_file(sb.buf, "added with --lock"); + write_file(sb.buf, _("added with --lock")); strbuf_addf(&sb_git, "%s/.git", path); if (safe_create_leading_directories_const(sb_git.buf)) From patchwork Thu Jul 15 02:32:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Manz X-Patchwork-Id: 12378297 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0006C12002 for ; Thu, 15 Jul 2021 02:32:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9691B613CA for ; Thu, 15 Jul 2021 02:32:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236483AbhGOCfa (ORCPT ); Wed, 14 Jul 2021 22:35:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232435AbhGOCf2 (ORCPT ); Wed, 14 Jul 2021 22:35:28 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A9A1C061762 for ; Wed, 14 Jul 2021 19:32:36 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id m2so5666365wrq.2 for ; Wed, 14 Jul 2021 19:32:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=fHMUVvRL4P4XuScojtpjWOg0oCdfMZEVV7HmcvsxqVw=; b=uCNs9kPRreGhdQCxoR0LVk0GwLzpeRyTmR0PRDaiwYsUonzK9e0KSyvF/WZcrO+ftG +U0rset5Pah7EYesFWHPclm8cEp5y0BMOd6dhoMfEYCesvgZ4kd0HI6rG05Af2fcVdDS ++VLdqvxbRbwzDC4RSMLmTlyTyJrguFeVnQoLgemLu4Kyr7zvXSrWrduIoKGnwO4ep+D NzYn7AGPPTOOKXywPJPlLgaIh7D80+RDySwj5pfDIExX4tD4fk/5I8ezLsXadExBaPHY hyCpS8SEIqwTRqpWs+lHcOHIqjGOxuoNSbwU4m382v5GXLRnL93+7ZzpxKJB2er7etD/ dp9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=fHMUVvRL4P4XuScojtpjWOg0oCdfMZEVV7HmcvsxqVw=; b=b6to3zJWoaP8sHJFNvFf+tjz//aDDNGXB+kRS39hdQ/ozOnDhFTD1SjODjuFaZia3p hD5OoLfoJxJEjS4xznyKErIpgjTWoUDSr5SrtDlv3vd59hrk7EBoBNXJF5eiPJz4VA6s 8j0cHQ+Izoy/VBl/d6AYeTFLC7ANFypOMxGcallmLFpSAA3ciKavLjhaNtOknx7bpLmk yDhfCyXvypl4/IV2RoGJOqMsiYA1shOFzO51DFznokY0OqM6HrsX2f88UtSsGGEJ3uID GOFxyJY3EiT1UBYw5pJjh3BCpBbnuEPMBpbQPtOnxaqQfZuSJbQl0qyK/mWYwEpR1Tij +22g== X-Gm-Message-State: AOAM532PzgSkNiEMnmS+0D+HPot+E/emTvwrvJW/xOzXHx9yB0XXGmFh OkBg1BD3/Eay8lZJfDqrDjji6ZaPtw0= X-Google-Smtp-Source: ABdhPJx19vRy0n5TqCAg+IyxPqgHXl6YbrOM5trhWYjvwvgjTzoGjpIU4HQy7tz6JwPD7klySSp/VQ== X-Received: by 2002:adf:ce8d:: with SMTP id r13mr1771922wrn.304.1626316354559; Wed, 14 Jul 2021 19:32:34 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id j6sm4289552wrm.97.2021.07.14.19.32.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jul 2021 19:32:34 -0700 (PDT) Message-Id: <4b6bb50d3d66ce8b033c475fbb9d3bda672e2612.1626316350.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Thu, 15 Jul 2021 02:32:30 +0000 Subject: [PATCH v4 3/3] worktree: teach `add` to accept --reason with --lock Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Eric Sunshine , Stephen Manz , Stephen Manz Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Stephen Manz From: Stephen Manz The default reason stored in the lock file, "added with --lock", is unlikely to be what the user would have given in a separate `git worktree lock` command. Allowing `--reason` to be specified along with `--lock` when adding a working tree gives the user control over the reason for locking without needing a second command. Signed-off-by: Stephen Manz --- Documentation/git-worktree.txt | 4 ++-- builtin/worktree.c | 21 ++++++++++++++++----- t/t2400-worktree-add.sh | 14 ++++++++++++++ 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt index 66e67e6cbfa..8a7cbdd19c1 100644 --- a/Documentation/git-worktree.txt +++ b/Documentation/git-worktree.txt @@ -9,7 +9,7 @@ git-worktree - Manage multiple working trees SYNOPSIS -------- [verse] -'git worktree add' [-f] [--detach] [--checkout] [--lock] [-b ] [] +'git worktree add' [-f] [--detach] [--checkout] [--lock [--reason ]] [-b ] [] 'git worktree list' [--porcelain] 'git worktree lock' [--reason ] 'git worktree move' @@ -242,7 +242,7 @@ With `list`, annotate missing working trees as prunable if they are older than `