@@ -114,10 +114,11 @@ strlen () {
114114run_tests  () {
115115    type=$1 
116116    object_name=" $2 " 
117-     size=$3 
118-     content=$4 
119-     pretty_content=$5 
120-     oid=${6:- " $object_name "  
117+     mode=$3 
118+     size=$4 
119+     content=$5 
120+     pretty_content=$6 
121+     oid=${7:- " $object_name "  
121122
122123    batch_output=" $oid  $type  $size 
123124$content " 
@@ -209,6 +210,12 @@ $content"
209210	test_cmp expect actual 
210211    '  
211212
213+     test_expect_success ' --batch-check with %(objectmode)' ' 
214+ 	echo "$mode $oid" >expect && 
215+ 	echo $object_name | git cat-file --batch-check="%(objectmode) %(objectname)" >actual && 
216+ 	test_cmp expect actual 
217+     '  
218+ 
212219    test  -z " $content " || 
213220    test_expect_success " --batch without type ($type )" ' 
214221	{ 
@@ -247,8 +254,7 @@ test_expect_success "setup" '
247254
248255run_blob_tests  () {
249256    oid=$1 
250- 
251-     run_tests ' blob' $oid  $hello_size  " $hello_content " " $hello_content " 
257+     run_tests ' blob' $oid  " " $hello_size  " $hello_content " " $hello_content " 
252258
253259    test_expect_success ' --batch-command --buffer with flush for blob info' ' 
254260	echo "$oid blob $hello_size" >expect && 
@@ -286,12 +292,12 @@ tree_compat_size=$((2 * $(test_oid --hash=compat rawsz) + 13 + 24))
286292tree_pretty_content=" 100644 blob $hello_oid 	hello${LF} 100755 blob $hello_oid 	path with spaces${LF} " 
287293tree_compat_pretty_content=" 100644 blob $hello_compat_oid 	hello${LF} 100755 blob $hello_compat_oid 	path with spaces${LF} " 
288294
289- run_tests ' tree' $tree_oid  $tree_size  " " " $tree_pretty_content " 
290- run_tests ' tree' $tree_compat_oid  $tree_compat_size  " " " $tree_compat_pretty_content " 
291- run_tests ' blob' " $tree_oid :hello" $hello_size  " " " $hello_content " $hello_oid 
292- run_tests ' blob' " $tree_compat_oid :hello" $hello_size  " " " $hello_content " $hello_compat_oid 
293- run_tests ' blob' " $tree_oid :path with spaces" $hello_size  " " " $hello_content " $hello_oid 
294- run_tests ' blob' " $tree_compat_oid :path with spaces" $hello_size  " " " $hello_content " $hello_compat_oid 
295+ run_tests ' tree' $tree_oid  " "   $tree_size  " " " $tree_pretty_content " 
296+ run_tests ' tree' $tree_compat_oid  " "   $tree_compat_size  " " " $tree_compat_pretty_content " 
297+ run_tests ' blob' " $tree_oid :hello" " 100644 "   $hello_size  " " " $hello_content " $hello_oid 
298+ run_tests ' blob' " $tree_compat_oid :hello" " 100644 "   $hello_size  " " " $hello_content " $hello_compat_oid 
299+ run_tests ' blob' " $tree_oid :path with spaces" " 100755 "   $hello_size  " " " $hello_content " $hello_oid 
300+ run_tests ' blob' " $tree_compat_oid :path with spaces" " 100755 "   $hello_size  " " " $hello_content " $hello_compat_oid 
295301
296302commit_message=" Initial commit" 
297303commit_oid=$( echo_without_newline " $commit_message " |  git commit-tree $tree_oid ) 
@@ -310,8 +316,8 @@ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
310316
311317$commit_message " 
312318
313- run_tests ' commit' $commit_oid  $commit_size  " $commit_content " " $commit_content " 
314- run_tests ' commit' $commit_compat_oid  $commit_compat_size  " $commit_compat_content " " $commit_compat_content " 
319+ run_tests ' commit' $commit_oid  " "   $commit_size  " $commit_content " " $commit_content " 
320+ run_tests ' commit' $commit_compat_oid  " "   $commit_compat_size  " $commit_compat_content " " $commit_compat_content " 
315321
316322tag_header_without_oid=" type blob
317323tag hellotag 
@@ -334,8 +340,8 @@ tag_size=$(strlen "$tag_content")
334340tag_compat_oid=$( git rev-parse --output-object-format=$test_compat_hash_algo  $tag_oid ) 
335341tag_compat_size=$( strlen " $tag_compat_content " ) 
336342
337- run_tests ' tag' $tag_oid  $tag_size  " $tag_content " " $tag_content " 
338- run_tests ' tag' $tag_compat_oid  $tag_compat_size  " $tag_compat_content " " $tag_compat_content " 
343+ run_tests ' tag' $tag_oid  " "   $tag_size  " $tag_content " " $tag_content " 
344+ run_tests ' tag' $tag_compat_oid  " "   $tag_compat_size  " $tag_compat_content " " $tag_compat_content " 
339345
340346test_expect_success " Reach a blob from a tag pointing to it" ' 
341347	echo_without_newline "$hello_content" >expect && 
0 commit comments