grep "short SHA1 000000000 is ambiguous" actual
'
-test_expect_failure 'disambiguate tree-ish' '
+test_expect_success 'disambiguate tree-ish' '
# feed tree-ish in an unambiguous way
git rev-parse --verify 0000000000cdc:a0blgqsjc &&
git rev-parse --verify 000000000:a0blgqsjc
'
-test_expect_failure 'disambiguate blob' '
+test_expect_success 'disambiguate blob' '
sed -e "s/|$//" >patch <<-EOF &&
diff --git a/frotz b/frotz
index 000000000..ffffff 100644
test_cmp a0blgqsjc actual
'
-test_expect_failure 'disambiguate tree' '
+test_expect_success 'disambiguate tree' '
commit=$(echo "d7xm" | git commit-tree 000000000) &&
test $(git rev-parse $commit^{tree}) = $(git rev-parse 0000000000cdc)
'
git commit -m a2onsxbvj
'
-test_expect_failure 'disambiguate commit-ish' '
+test_expect_success 'disambiguate commit-ish' '
# feed commit-ish in an unambiguous way
git rev-parse --verify 0000000000e4f^{commit} &&
git rev-parse --verify 000000000^0
'
-test_expect_failure 'disambiguate commit' '
- commit=$(echo "j9xqh" | git commit-tree 0000000000cdc -p 000000000) &&
+test_expect_success 'disambiguate commit' '
+ commit=$(echo "hoaxj" | git commit-tree 0000000000cdc -p 000000000) &&
test $(git rev-parse $commit^) = $(git rev-parse 0000000000e4f)
'
-test_expect_failure 'log name1..name2 takes only commit-ishes on both ends' '
+test_expect_success 'log name1..name2 takes only commit-ishes on both ends' '
git log 000000000..000000000 &&
git log ..000000000 &&
git log 000000000.. &&
git log 000000000...
'
-test_expect_failure 'rev-parse name1..name2 takes only commit-ishes on both ends' '
+test_expect_success 'rev-parse name1..name2 takes only commit-ishes on both ends' '
git rev-parse 000000000..000000000 &&
git rev-parse ..000000000 &&
git rev-parse 000000000..
'
-test_expect_failure 'git log takes only commit-ish' '
+test_expect_success 'git log takes only commit-ish' '
git log 000000000
'
-test_expect_failure 'git reset takes only commit-ish' '
+test_expect_success 'git reset takes only commit-ish' '
git reset 000000000
'
test_must_fail git log 000000000...
'
+test_expect_success 'rev-parse --disambiguate' '
+ # The test creates 16 objects that share the prefix and two
+ # commits created by commit-tree in earlier tests share a
+ # different prefix.
+ git rev-parse --disambiguate=000000000 >actual &&
+ test $(wc -l <actual) = 16 &&
+ test "$(sed -e "s/^\(.........\).*/\1/" actual | sort -u)" = 000000000
+'
+
test_done