summaryrefslogtreecommitdiff
path: root/t/t1006-cat-file.sh
diff options
context:
space:
mode:
authorLea Wiemann <lewiemann@gmail.com>2008-06-09 00:02:21 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-06-09 20:46:08 (GMT)
commit3c076dbe3cffee3b5cbf34759d627c47a417c145 (patch)
treed4d2d86ca6409739f69cec826e6c813a1234672d /t/t1006-cat-file.sh
parent4e44ae45fe96c6972c3e5d4aac2a149972429deb (diff)
downloadgit-3c076dbe3cffee3b5cbf34759d627c47a417c145.zip
git-3c076dbe3cffee3b5cbf34759d627c47a417c145.tar.gz
git-3c076dbe3cffee3b5cbf34759d627c47a417c145.tar.bz2
cat-file --batch / --batch-check: do not exit if hashes are missing
Previously, cat-file --batch / --batch-check would silently exit if it was passed a non-existent SHA1 on stdin. Now it prints "<SHA1> missing" as in all other cases (and as advertised in the documentation). Note that cat-file --batch-check (but not --batch) will still output "error: unable to find <SHA1>" on stderr if a non-existent SHA1 is passed, but this does not affect parsing its stdout. Also, type <= 0 was previously using the potentially uninitialized type variable (relying on it being 0); it is now being initialized. Signed-off-by: Lea Wiemann <LeWiemann@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1006-cat-file.sh')
-rwxr-xr-xt/t1006-cat-file.sh24
1 files changed, 21 insertions, 3 deletions
diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh
index 973aef7..d8b7f2f 100755
--- a/t/t1006-cat-file.sh
+++ b/t/t1006-cat-file.sh
@@ -174,9 +174,27 @@ do
'
done
-test_expect_success "--batch-check for a non-existent object" '
- test "deadbeef missing" = \
- "$(echo_without_newline deadbeef | git cat-file --batch-check)"
+test_expect_success "--batch-check for a non-existent named object" '
+ test "foobar42 missing
+foobar84 missing" = \
+ "$( ( echo foobar42; echo_without_newline foobar84; ) | git cat-file --batch-check)"
+'
+
+test_expect_success "--batch-check for a non-existent hash" '
+ test "0000000000000000000000000000000000000042 missing
+0000000000000000000000000000000000000084 missing" = \
+ "$( ( echo 0000000000000000000000000000000000000042;
+ echo_without_newline 0000000000000000000000000000000000000084; ) \
+ | git cat-file --batch-check)"
+'
+
+test_expect_success "--batch for an existent and a non-existent hash" '
+ test "$tag_sha1 tag $tag_size
+$tag_content
+0000000000000000000000000000000000000000 missing" = \
+ "$( ( echo $tag_sha1;
+ echo_without_newline 0000000000000000000000000000000000000000; ) \
+ | git cat-file --batch)"
'
test_expect_success "--batch-check for an emtpy line" '