]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jk/cat-file-batch-wo-type-fix' into jch
authorJunio C Hamano <gitster@pobox.com>
Thu, 30 Jul 2026 17:40:43 +0000 (10:40 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 30 Jul 2026 17:40:44 +0000 (10:40 -0700)
"git cat-file --batch-command" that asked for 'contents' without
'type' segfaults, which has been corrected.

* jk/cat-file-batch-wo-type-fix:
  cat-file: handle content request for --batch-command without type

1  2 
builtin/cat-file.c
t/t1006-cat-file.sh

Simple merge
index 0c1dc0fb400d7dad8673f0dd5d844bbfddf66b31,d0db1f2a2917da9a5947d9c6cfa19506a90bdc82..72fc8acc611927ea590bf26c5f00f7151308859b
@@@ -1337,9 -1348,17 +1337,17 @@@ test_expect_success 'batch-command flus
  test_expect_success 'batch-command flush without --buffer' '
        echo "flush" >cmd &&
        test_expect_code 128 git cat-file --batch-command <cmd 2>err &&
 -      grep "^fatal:.*flush is only for --buffer mode.*" err
 +      test_grep "^fatal:.*flush is only for --buffer mode.*" err
  '
  
+ test_expect_success 'batch-command contents auto-handles type' '
+       echo "HEAD" |
+               git cat-file --batch="%(objectname)" >expect &&
+       echo "contents HEAD" |
+               git cat-file --batch-command="%(objectname)" >actual &&
+       test_cmp expect actual
+ '
  perl_script='
  use warnings;
  use strict;