Code

rebase: fix "rebase --continue" breakage
[git.git] / t / t7201-co.sh
index 5fa6a45577894e05446351fc5076a27accb1fa9f..55558aba8b862b93cb8ad97a681a4749bae3b3e1 100755 (executable)
@@ -77,7 +77,7 @@ test_expect_success "checkout with dirty tree without -m" '
 test_expect_success "checkout -m with dirty tree" '
 
        git checkout -f master &&
-       git clean &&
+       git clean -f &&
 
        fill 0 1 2 3 4 5 6 7 8 >one &&
        git checkout -m side &&
@@ -99,7 +99,7 @@ test_expect_success "checkout -m with dirty tree" '
 
 test_expect_success "checkout -m with dirty tree, renamed" '
 
-       git checkout -f master && git clean &&
+       git checkout -f master && git clean -f &&
 
        fill 1 2 3 4 5 7 8 >one &&
        if git checkout renamer
@@ -121,7 +121,7 @@ test_expect_success "checkout -m with dirty tree, renamed" '
 
 test_expect_success 'checkout -m with merge conflict' '
 
-       git checkout -f master && git clean &&
+       git checkout -f master && git clean -f &&
 
        fill 1 T 3 4 5 6 S 8 >one &&
        if git checkout renamer
@@ -144,7 +144,7 @@ test_expect_success 'checkout -m with merge conflict' '
 
 test_expect_success 'checkout to detach HEAD' '
 
-       git checkout -f renamer && git clean &&
+       git checkout -f renamer && git clean -f &&
        git checkout renamer^ &&
        H=$(git rev-parse --verify HEAD) &&
        M=$(git show-ref -s --verify refs/heads/master) &&
@@ -160,7 +160,7 @@ test_expect_success 'checkout to detach HEAD' '
 
 test_expect_success 'checkout to detach HEAD with branchname^' '
 
-       git checkout -f master && git clean &&
+       git checkout -f master && git clean -f &&
        git checkout renamer^ &&
        H=$(git rev-parse --verify HEAD) &&
        M=$(git show-ref -s --verify refs/heads/master) &&
@@ -176,7 +176,7 @@ test_expect_success 'checkout to detach HEAD with branchname^' '
 
 test_expect_success 'checkout to detach HEAD with HEAD^0' '
 
-       git checkout -f master && git clean &&
+       git checkout -f master && git clean -f &&
        git checkout HEAD^0 &&
        H=$(git rev-parse --verify HEAD) &&
        M=$(git show-ref -s --verify refs/heads/master) &&
@@ -190,4 +190,44 @@ test_expect_success 'checkout to detach HEAD with HEAD^0' '
        fi
 '
 
+test_expect_success 'checkout with ambiguous tag/branch names' '
+
+       git tag both side &&
+       git branch both master &&
+       git reset --hard &&
+       git checkout master &&
+
+       git checkout both &&
+       H=$(git rev-parse --verify HEAD) &&
+       M=$(git show-ref -s --verify refs/heads/master) &&
+       test "z$H" = "z$M" &&
+       name=$(git symbolic-ref HEAD 2>/dev/null) &&
+       test "z$name" = zrefs/heads/both
+
+'
+
+test_expect_success 'checkout with ambiguous tag/branch names' '
+
+       git reset --hard &&
+       git checkout master &&
+
+       git tag frotz side &&
+       git branch frotz master &&
+       git reset --hard &&
+       git checkout master &&
+
+       git checkout tags/frotz &&
+       H=$(git rev-parse --verify HEAD) &&
+       S=$(git show-ref -s --verify refs/heads/side) &&
+       test "z$H" = "z$S" &&
+       if name=$(git symbolic-ref HEAD 2>/dev/null)
+       then
+               echo "Bad -- should have detached"
+               false
+       else
+               : happy
+       fi
+
+'
+
 test_done