Re: [PATCH v2 6/6] worktree: teach `list` verbose mode
flat view
From: Eric Sunshine <hidden>
Date: 2021-01-18 19:41:55
On Mon, Jan 18, 2021 at 12:15 AM Eric Sunshine [off-list ref] wrote:
On Sun, Jan 17, 2021 at 6:43 PM Rafael Silva [off-list ref] wrote:quoted
+test_expect_success '"list" all worktrees --verbose with locked' ' + test_when_finished "rm -rf locked out actual expect && git worktree prune" && + git worktree add locked --detach && + git worktree lock locked --reason "with reason" && + test_when_finished "git worktree unlock locked" && + echo "$(git -C locked rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)" >expect && + printf "\tlocked: with reason\n" >>expect && + git worktree list --verbose >out && + sed -n "s/ */ /g;/\/locked *[0-9a-f].*$/,/locked: .*$/p" <out >actual && + test_cmp actual expect +'At first, I wondered if we would also want this test to have a locked-no-reason worktree to ensure that its `locked` annotation stays on the same line as the worktree, but that's not needed because that case is already covered by the existing test. Fine.
Erm, I think what I said is wrong. There is no existing test to show that `locked` without a reason stays on the same line as the worktree in --verbose mode. So having a locked-no-reason worktree in this test could be beneficial.