Skip to content

Commit 16ba0f4

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

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

builtin/cat-file.c

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

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

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

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

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)