t6050: show that git cat-file --batch fails with replace objects

When --batch is passed to git cat-file, the sha1_object_info_extended() function is used to get information about the objects passed to git cat-file. Unfortunately sha1_object_info_extended() doesn't take care of object replacement properly, so it will often fail with a message like this: $ echo a3fb2e1845a1aaf129b7975048973414dc172173 | git cat-file --batch a3fb2e1845a1aaf129b7975048973414dc172173 commit 231 fatal: object a3fb2e1845a1aaf129b7975048973414dc172173 change size!? The goal of this patch is to show this breakage. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Christian Couder committed Dec 11, 2013 at 08:46 UTC 303c5d65c972de2e9d0821647b06ab595c21d355
1 file changed +5
t/t6050-replace.sh
+5
@@ -276,6 +276,11 @@ test_expect_success '-f option bypasses the type check' '
276 git replace -f HEAD^ $BLOB
277 '
278
279 +test_expect_failure 'git cat-file --batch works on replace objects' '
280 + git replace | grep $PARA3 &&
281 + echo $PARA3 | git cat-file --batch
282 +'
283 +
284 test_expect_success 'replace ref cleanup' '
285 test -n "$(git replace)" &&
286 git replace -d $(git replace) &&