Merge branch 'ss/fix-config-fd-leak'
[gitweb.git] / t / t2019-checkout-ambiguous-ref.sh
index 943541d40d7ea331dd0ae85624a33b9f2258246c..199b22d85e92535f148eaaca4d3856dbdfb6bcec 100755 (executable)
@@ -30,8 +30,8 @@ test_expect_success 'checkout chooses branch over tag' '
 '
 
 test_expect_success 'checkout reports switch to branch' '
-       grep "Switched to branch" stderr &&
-       ! grep "^HEAD is now at" stderr
+       test_i18ngrep "Switched to branch" stderr &&
+       test_i18ngrep ! "^HEAD is now at" stderr
 '
 
 test_expect_success 'checkout vague ref succeeds' '
@@ -52,8 +52,34 @@ test_expect_success VAGUENESS_SUCCESS 'checkout chooses branch over tag' '
 '
 
 test_expect_success VAGUENESS_SUCCESS 'checkout reports switch to branch' '
-       grep "Switched to branch" stderr &&
-       ! grep "^HEAD is now at" stderr
+       test_i18ngrep "Switched to branch" stderr &&
+       test_i18ngrep ! "^HEAD is now at" stderr
+'
+
+test_expect_success 'wildcard ambiguation, paths win' '
+       git init ambi &&
+       (
+               cd ambi &&
+               echo a >a.c &&
+               git add a.c &&
+               echo b >a.c &&
+               git checkout "*.c" &&
+               echo a >expect &&
+               test_cmp expect a.c
+       )
+'
+
+test_expect_success !MINGW 'wildcard ambiguation, refs lose' '
+       git init ambi2 &&
+       (
+               cd ambi2 &&
+               echo a >"*.c" &&
+               git add . &&
+               test_must_fail git show :"*.c" &&
+               git show :"*.c" -- >actual &&
+               echo a >expect &&
+               test_cmp expect actual
+       )
 '
 
 test_done