Merge branch 'jk/ident-ai-canonname-could-be-null' into maint
[gitweb.git] / t / t2024-checkout-dwim.sh
index 468a000e4bbb113d004ee8df8ef0db9b8260fdb5..3e5ac81bd29bf6aded0d0fa643dca448a281d481 100755 (executable)
@@ -174,6 +174,18 @@ test_expect_success 'checkout of branch with a file having the same name fails'
        test_branch master
 '
 
+test_expect_success 'checkout of branch with a file in subdir having the same name fails' '
+       git checkout -B master &&
+       test_might_fail git branch -D spam &&
+
+       >spam &&
+       mkdir sub &&
+       mv spam sub/spam &&
+       test_must_fail git -C sub checkout spam &&
+       test_must_fail git rev-parse --verify refs/heads/spam &&
+       test_branch master
+'
+
 test_expect_success 'checkout <branch> -- succeeds, even if a file with the same name exists' '
        git checkout -B master &&
        test_might_fail git branch -D spam &&