Imported Upstream version 2.12.1
[platform/upstream/git.git] / t / t2010-checkout-ambiguous.sh
index 7cc0a35..2e47fe0 100755 (executable)
@@ -41,10 +41,25 @@ test_expect_success 'check ambiguity' '
        test_must_fail git checkout world all
 '
 
+test_expect_success 'check ambiguity in subdir' '
+       mkdir sub &&
+       # not ambiguous because sub/world does not exist
+       git -C sub checkout world ../all &&
+       echo hello >sub/world &&
+       # ambiguous because sub/world does exist
+       test_must_fail git -C sub checkout world ../all
+'
+
 test_expect_success 'disambiguate checking out from a tree-ish' '
        echo bye > world &&
        git checkout world -- world &&
        git diff --exit-code --quiet
 '
 
+test_expect_success 'accurate error message with more than one ref' '
+       test_must_fail git checkout HEAD master -- 2>actual &&
+       test_i18ngrep 2 actual &&
+       test_i18ngrep "one reference expected, 2 given" actual
+'
+
 test_done