]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'zh/cat-file-batch-fix'
authorJunio C Hamano <gitster@pobox.com>
Tue, 13 Jul 2021 23:52:49 +0000 (16:52 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 13 Jul 2021 23:52:49 +0000 (16:52 -0700)
"git cat-file --batch-all-objects"" misbehaved when "--batch" is in
use and did not ask for certain object traits.

* zh/cat-file-batch-fix:
  cat-file: merge two block into one
  cat-file: handle trivial --batch format with --batch-all-objects

1  2 
t/t1006-cat-file.sh

diff --combined t/t1006-cat-file.sh
index 5d2dc99b74ad005e00ae76c1c6616100238e414e,fa0759d7a4442845992e87b14081df2bb77d934e..18b3779ccb6014b5c268d0c29e6616f6728395af
@@@ -166,7 -166,7 +166,7 @@@ tag_content="$tag_header_without_timest
  
  $tag_description"
  
 -tag_sha1=$(echo_without_newline "$tag_content" | git mktag)
 +tag_sha1=$(echo_without_newline "$tag_content" | git hash-object -t tag --stdin -w)
  tag_size=$(strlen "$tag_content")
  
  run_tests 'tag' $tag_sha1 $tag_size "$tag_content" "$tag_content" 1
@@@ -586,4 -586,26 +586,26 @@@ test_expect_success 'cat-file --unorder
        test_cmp expect actual
  '
  
+ test_expect_success 'set up object list for --batch-all-objects tests' '
+       git -C all-two cat-file --batch-all-objects --batch-check="%(objectname)" >objects
+ '
+ test_expect_success 'cat-file --batch="%(objectname)" with --batch-all-objects will work' '
+       git -C all-two cat-file --batch="%(objectname)" <objects >expect &&
+       git -C all-two cat-file --batch-all-objects --batch="%(objectname)" >actual &&
+       cmp expect actual
+ '
+ test_expect_success 'cat-file --batch="%(rest)" with --batch-all-objects will work' '
+       git -C all-two cat-file --batch="%(rest)" <objects >expect &&
+       git -C all-two cat-file --batch-all-objects --batch="%(rest)" >actual &&
+       cmp expect actual
+ '
+ test_expect_success 'cat-file --batch="batman" with --batch-all-objects will work' '
+       git -C all-two cat-file --batch="batman" <objects >expect &&
+       git -C all-two cat-file --batch-all-objects --batch="batman" >actual &&
+       cmp expect actual
+ '
  test_done