[RFC PATCH 2/2] t2402: add test to locked linked worktree marker
- From
Rafael Silva <rafaeloliveira.cs@gmail.com>
- Date
- Sep 28, 2020, 15:49 UTC
- Message-ID
- <20200928154953.30396-3-rafaeloliveira.cs@gmail.com>
- In-Reply-To
- <20200928154953.30396-1-rafaeloliveira.cs@gmail.com>
Test the output of the `worktree list` command to show when a linked worktree is locked and test to not mistakenly mark main or unlocked worktrees.
Signed-off-by: Rafael Silva <rafaeloliveira.cs@gmail.com> --- t/t2402-worktree-list.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/t/t2402-worktree-list.sh b/t/t2402-worktree-list.sh index 52585ec2aa..07bd9a3350 100755 --- a/t/t2402-worktree-list.sh +++ b/t/t2402-worktree-list.sh @@ -61,6 +61,19 @@ test_expect_success '"list" all worktrees --porcelain' ' test_cmp expect actual ' +test_expect_success 'show locked worktree with (locked)' ' + echo "$(git rev-parse --show-toplevel) $(git rev-parse --short HEAD) [$(git symbolic-ref --short HEAD)]" >expect && + test_when_finished "rm -rf locked unlocked out actual expect && git worktree prune" && + git worktree add --detach locked master && + git worktree add --detach unlocked master && + git worktree lock locked && + echo "$(git -C locked rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD) (locked)" >>expect && + echo "$(git -C unlocked rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)" >>expect && + git worktree list >out && + sed "s/ */ /g" <out >actual && + test_cmp expect actual +' + test_expect_success 'bare repo setup' ' git init --bare bare1 && echo "data" >file1 &&
-- 2.28.0.763.ge7086f1eef