add_packed_ref(): teach function to overwrite existing refs
[gitweb.git] / t / t1512-rev-parse-disambiguation.sh
index c5447ef8779bec14cbc47960494a20b6660229db..711704ba5a052b15d94ff1ce958ada3fb86530a9 100755 (executable)
@@ -42,7 +42,7 @@ test_expect_success 'blob and tree' '
 
 test_expect_success 'warn ambiguity when no candidate matches type hint' '
        test_must_fail git rev-parse --verify 000000000^{commit} 2>actual &&
-       grep "short SHA1 000000000 is ambiguous" actual
+       test_i18ngrep "short SHA1 000000000 is ambiguous" actual
 '
 
 test_expect_success 'disambiguate tree-ish' '
@@ -347,4 +347,18 @@ test_expect_success C_LOCALE_OUTPUT 'failed type-selector still shows hint' '
        test_line_count = 3 hints
 '
 
+test_expect_success 'core.disambiguate config can prefer types' '
+       # ambiguous between tree and tag
+       sha1=0000000000f &&
+       test_must_fail git rev-parse $sha1 &&
+       git rev-parse $sha1^{commit} &&
+       git -c core.disambiguate=committish rev-parse $sha1
+'
+
+test_expect_success 'core.disambiguate does not override context' '
+       # treeish ambiguous between tag and tree
+       test_must_fail \
+               git -c core.disambiguate=committish rev-parse $sha1^{tree}
+'
+
 test_done