pack-objects: document about thread synchronization
[gitweb.git] / t / t1512-rev-parse-disambiguation.sh
index 711704ba5a052b15d94ff1ce958ada3fb86530a9..96fe3754c8c96fd65286d4eea44cb65b0edde343 100755 (executable)
@@ -22,6 +22,12 @@ one tagged as v1.0.0.  They all have one regular file each.
 
 . ./test-lib.sh
 
+if ! test_have_prereq SHA1
+then
+       skip_all='not using SHA-1 for objects'
+       test_done
+fi
+
 test_expect_success 'blob and tree' '
        test_tick &&
        (
@@ -361,4 +367,25 @@ test_expect_success 'core.disambiguate does not override context' '
                git -c core.disambiguate=committish rev-parse $sha1^{tree}
 '
 
+test_expect_success C_LOCALE_OUTPUT 'ambiguous commits are printed by type first, then hash order' '
+       test_must_fail git rev-parse 0000 2>stderr &&
+       grep ^hint: stderr >hints &&
+       grep 0000 hints >objects &&
+       cat >expected <<-\EOF &&
+       tag
+       commit
+       tree
+       blob
+       EOF
+       awk "{print \$3}" <objects >objects.types &&
+       uniq <objects.types >objects.types.uniq &&
+       test_cmp expected objects.types.uniq &&
+       for type in tag commit tree blob
+       do
+               grep $type objects >$type.objects &&
+               sort $type.objects >$type.objects.sorted &&
+               test_cmp $type.objects.sorted $type.objects
+       done
+'
+
 test_done