Merge branch 'nb/branch-show-other-worktrees-head'
[gitweb.git] / t / t3203-branch-output.sh
index a3436bf25a63a37c4c46433e41ad868230b5b6ba..71818b90f00d3727cb00e24da181fc9dec420f08 100755 (executable)
@@ -136,13 +136,14 @@ test_expect_success 'git branch `--show-current` works properly with worktrees'
        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
 '
 
@@ -328,4 +329,23 @@ test_expect_success '--color overrides auto-color' '
        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