branch-two
EOF
git checkout branch-one &&
+ test_when_finished "
+ git worktree remove worktree_dir
+ " &&
git worktree add worktree_dir branch-two &&
{
git branch --show-current &&
git -C worktree_dir branch --show-current
} >actual &&
- rm -r worktree_dir &&
- git worktree prune &&
test_cmp expect actual
'
test_cmp expect.color actual
'
+test_expect_success 'verbose output lists worktree path' '
+ one=$(git rev-parse --short HEAD) &&
+ two=$(git rev-parse --short master) &&
+ cat >expect <<-EOF &&
+ * (HEAD detached from fromtag) $one one
+ ambiguous $one one
+ branch-one $two two
+ + branch-two $one ($(pwd)/worktree_dir) one
+ master $two two
+ ref-to-branch $two two
+ ref-to-remote $two two
+ EOF
+ git worktree add worktree_dir branch-two &&
+ git branch -vv >actual &&
+ rm -r worktree_dir &&
+ git worktree prune &&
+ test_i18ncmp expect actual
+'
+
test_done