mirror of
https://github.com/git/git.git
synced 2026-08-09 09:34:14 +00:00
Merge branch 'jk/cat-file-batch-wo-type-fix'
'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
This commit is contained in:
@@ -789,8 +789,11 @@ static void parse_cmd_contents(struct batch_options *opt,
|
||||
struct strbuf *output,
|
||||
struct expand_data *data)
|
||||
{
|
||||
enum object_type *saved_typep = data->info.typep;
|
||||
data->info.typep = &data->type;
|
||||
opt->batch_mode = BATCH_MODE_CONTENTS;
|
||||
batch_one_object(line, output, opt, data);
|
||||
data->info.typep = saved_typep;
|
||||
}
|
||||
|
||||
static void parse_cmd_info(struct batch_options *opt,
|
||||
|
||||
@@ -1340,6 +1340,14 @@ test_expect_success 'batch-command flush without --buffer' '
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user