From: Junio C Hamano Date: Fri, 27 Dec 2013 22:58:11 +0000 (-0800) Subject: Merge branch 'jk/cat-file-regression-fix' X-Git-Tag: v1.9-rc0~51 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/604ada435b78a473baa6962a90def78ccb186c58?ds=inline;hp=-c Merge branch 'jk/cat-file-regression-fix' "git cat-file --batch=", an admittedly useless command, did not behave very well. * jk/cat-file-regression-fix: cat-file: handle --batch format with missing type/size cat-file: pass expand_data to print_object_or_die --- 604ada435b78a473baa6962a90def78ccb186c58 diff --combined t/t1006-cat-file.sh index 8a1bc5c532,df2ae67189..1687098355 --- a/t/t1006-cat-file.sh +++ b/t/t1006-cat-file.sh @@@ -85,6 -85,28 +85,28 @@@ $content git cat-file --batch-check="%(objecttype) %(rest)" >actual && test_cmp expect actual ' + + test -z "$content" || + test_expect_success "--batch without type ($type)" ' + { + echo "$size" && + maybe_remove_timestamp "$content" $no_ts + } >expect && + echo $sha1 | git cat-file --batch="%(objectsize)" >actual.full && + maybe_remove_timestamp "$(cat actual.full)" $no_ts >actual && + test_cmp expect actual + ' + + test -z "$content" || + test_expect_success "--batch without size ($type)" ' + { + echo "$type" && + maybe_remove_timestamp "$content" $no_ts + } >expect && + echo $sha1 | git cat-file --batch="%(objecttype)" >actual.full && + maybe_remove_timestamp "$(cat actual.full)" $no_ts >actual && + test_cmp expect actual + ' } hello_content="Hello World" @@@ -194,12 -216,6 +216,12 @@@ test_expect_success "--batch-check for test " missing" = "$(echo | git cat-file --batch-check)" ' +test_expect_success 'empty --batch-check notices missing object' ' + echo "$_z40 missing" >expect && + echo "$_z40" | git cat-file --batch-check="" >actual && + test_cmp expect actual +' + batch_input="$hello_sha1 $commit_sha1 $tag_sha1