| test_description='checkout and pathspecs/refspecs ambiguities' |
| test_expect_success 'setup' ' |
| test_expect_success 'reference must be a tree' ' |
| test_must_fail git checkout $(git hash-object ./all) -- |
| test_expect_success 'branch switching' ' |
| test "refs/heads/master" = "$(git symbolic-ref HEAD)" && |
| test "refs/heads/world" = "$(git symbolic-ref HEAD)" |
| test_expect_success 'checkout world from the index' ' |
| git diff --exit-code --quiet |
| test_expect_success 'non ambiguous call' ' |
| test_expect_success 'allow the most common case' ' |
| test "refs/heads/world" = "$(git symbolic-ref HEAD)" |
| test_expect_success 'check ambiguity' ' |
| test_must_fail git checkout world all |
| test_expect_success 'disambiguate checking out from a tree-ish' ' |
| git checkout world -- world && |
| git diff --exit-code --quiet |