[RFC PATCH 0/2] teach `worktree list` to mark locked worktrees
- From
Rafael Silva <rafaeloliveira.cs@gmail.com>
- Date
- Sep 28, 2020, 15:49 UTC
- Message-ID
- <20200928154953.30396-1-rafaeloliveira.cs@gmail.com>
This patch series introduces a new information on the git `worktree list` command output, to mark when a worktree is locked with a (locked) text mark.
The intent is to improve the user experience to earlier sinalize that a linked worktree is locked, instead of realising later when attempting to remove it with `remove` command as it happened to me twice :)
The patches are divided into two parts. First part introduces the new marker to the worktree list command and small documentation change. And the second adds one test case into t2402 to test if the (locked) text will be properly set for a locked worktree, and not mistankely set to a unlocked or master worktree.
This is the output of the worktree list with locked marker:
$ git worktree list /repo/to/main abc123 [master] /path/to/unlocked-worktree1 456def [brancha] /path/to/locked-worktree 123abc (detached HEAD) (locked)
This patches are marked with RFC mainly due to:
- This will change the default behaviour of the worktree list, I am
not sure whether will be better to make this tuned via a config
and/or a git parameter. (assuming this change is a good idea ;) ) - Perhaps the `(locked)` marker is not the best suitable way to output
this information and we might need to come with a better way. - I am a new contributor to the code base, still learning a lot of git
internals data structure and commands. Likely this patch will require
updates.Rafael Silva (2): teach `list` to mark locked worktree t2402: add test to locked linked worktree marker
Documentation/git-worktree.txt | 5 +++-- builtin/worktree.c | 6 +++++- t/t2402-worktree-list.sh | 13 +++++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-)
-- 2.28.0.763.ge7086f1eef