Merge 'kn/for-each-tag-branch' into kn/for-each-tag
[gitweb.git] / t / t2025-worktree-add.sh
index 192c936735283aa94bf33f8bf1b09eb772bc33f7..ead8aa2a9d78c8f6451d19812d48ae5d69e6ee69 100755 (executable)
@@ -140,4 +140,23 @@ test_expect_success '"add" from relative HEAD' '
        test_cmp expected actual
 '
 
+test_expect_success '"add -b" with <branch> omitted' '
+       git worktree add -b burble flornk &&
+       test_cmp_rev HEAD burble
+'
+
+test_expect_success '"add" with <branch> omitted' '
+       git worktree add wiffle/bat &&
+       test_cmp_rev HEAD bat
+'
+
+test_expect_success '"add" auto-vivify does not clobber existing branch' '
+       test_commit c1 &&
+       test_commit c2 &&
+       git branch precious HEAD~1 &&
+       test_must_fail git worktree add precious &&
+       test_cmp_rev HEAD~1 precious &&
+       test_path_is_missing precious
+'
+
 test_done