Code

Check early that a new branch is new and valid
[git.git] / t / t7201-co.sh
index fbec70d3c6abff4a97aa205aa10fbf6fe336fa5f..0679abd29d907944c5c246275adfcd760f001d55 100755 (executable)
@@ -359,4 +359,14 @@ test_expect_success 'checkout an unmerged path should fail' '
        test_cmp sample file
 '
 
+test_expect_success 'failing checkout -b should not break working tree' '
+       git reset --hard master &&
+       git symbolic-ref HEAD refs/heads/master &&
+       test_must_fail git checkout -b renamer side^ &&
+       test $(git symbolic-ref HEAD) = refs/heads/master &&
+       git diff --exit-code &&
+       git diff --cached --exit-code
+
+'
+
 test_done