Skip to content

Commit bfbc2fc

Browse files
committed
Merge branch 'jk/diff-blob'
"git cat-file --textconv" started segfaulting recently, which has been corrected. * jk/diff-blob: cat-file: handle NULL object_context.path
2 parents 8174645 + cc0ea7c commit bfbc2fc

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

builtin/cat-file.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
9797
return !has_object_file(&oid);
9898

9999
case 'w':
100-
if (!path[0])
100+
if (!path)
101101
die("git cat-file --filters %s: <object> must be "
102102
"<sha1:path>", obj_name);
103103

@@ -107,7 +107,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
107107
break;
108108

109109
case 'c':
110-
if (!path[0])
110+
if (!path)
111111
die("git cat-file --textconv %s: <object> must be <sha1:path>",
112112
obj_name);
113113

t/t8010-cat-file-filters.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ test_expect_success '--path=<path> complains without --textconv/--filters' '
5151
grep "path.*needs.*filters" err
5252
'
5353

54+
test_expect_success '--textconv/--filters complain without path' '
55+
test_must_fail git cat-file --textconv HEAD &&
56+
test_must_fail git cat-file --filters HEAD
57+
'
58+
5459
test_expect_success 'cat-file --textconv --batch works' '
5560
sha1=$(git rev-parse -q --verify HEAD:world.txt) &&
5661
test_config diff.txt.textconv "tr A-Za-z N-ZA-Mn-za-m <" &&

0 commit comments

Comments
 (0)