Re: [PATCH v3] worktree: teach `list` to annotate locked worktree
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Oct 12, 2020, 02:24 UTC
- Message-ID
- <CAPig+cS8hvX4GCsnfLBnQ4Q_AkUad=bw7rjVcaOqSEqcLZvx8w@mail.gmail.com>
- In-Reply-To
- <20201011101152.5291-2-rafaeloliveira.cs@gmail.com>
On Sun, Oct 11, 2020 at 6:12 AM Rafael Silva <rafaeloliveira.cs@gmail.com> wrote:
Show 8 quoted lines
> Teach "git worktree list" to append "locked" to its output. > > Signed-off-by: Rafael Silva <rafaeloliveira.cs@gmail.com> > --- > diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt > @@ -97,7 +97,8 @@ list:: > followed by each of the linked working trees. The output details include > whether the working tree is bare, the revision currently checked out, and the
Nit: I'd probably drop the "and" just before the end of this line...
> -branch currently checked out (or "detached HEAD" if none). > +branch currently checked out (or "detached HEAD" if none), and "locked" if > +the worktree is locked.
... which would leave just the one "and" here. However, this is minor and almost certainly not worth a re-roll.
Show 9 quoted lines
> +test_expect_success '"list" all worktress with locked annotation' ' > + test_when_finished "rm -rf locked unlocked out && git worktree prune" && > + git worktree add --detach locked master && > + git worktree add --detach unlocked master && > + git worktree lock locked && > + git worktree list >out && > + grep "/locked *[0-9a-f].* locked$" out && > + ! grep "/unlocked *[0-9a-f].* locked$" out > +'
Looks good. With or without the minor suggested documentation tweak, consider this patch:
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>