diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-09-28 14:47:53 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-09-28 14:47:53 +0900 |
commit | bfbc2fccfdff0fe189337de67e16fc132b8ee2a5 (patch) | |
tree | f08bb74506c440a64267b43675cdfcc4311fd345 | |
parent | 8174645831a4b2b0722469d4f360bc97da2e2a6a (diff) | |
parent | cc0ea7c9e5c3d3bf9623415737b595c9d26b9b6d (diff) | |
download | git-bfbc2fccfdff0fe189337de67e16fc132b8ee2a5.tar.gz git-bfbc2fccfdff0fe189337de67e16fc132b8ee2a5.tar.xz |
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
-rw-r--r-- | builtin/cat-file.c | 4 | ||||
-rwxr-xr-x | t/t8010-cat-file-filters.sh | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/builtin/cat-file.c b/builtin/cat-file.c index 4ccbfaac3..1ea25331d 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -97,7 +97,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name, return !has_object_file(&oid); case 'w': - if (!path[0]) + if (!path) die("git cat-file --filters %s: <object> must be " "<sha1:path>", obj_name); @@ -107,7 +107,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name, break; case 'c': - if (!path[0]) + if (!path) die("git cat-file --textconv %s: <object> must be <sha1:path>", obj_name); diff --git a/t/t8010-cat-file-filters.sh b/t/t8010-cat-file-filters.sh index d8242e467..0f86c1917 100755 --- a/t/t8010-cat-file-filters.sh +++ b/t/t8010-cat-file-filters.sh @@ -51,6 +51,11 @@ test_expect_success '--path=<path> complains without --textconv/--filters' ' grep "path.*needs.*filters" err ' +test_expect_success '--textconv/--filters complain without path' ' + test_must_fail git cat-file --textconv HEAD && + test_must_fail git cat-file --filters HEAD +' + test_expect_success 'cat-file --textconv --batch works' ' sha1=$(git rev-parse -q --verify HEAD:world.txt) && test_config diff.txt.textconv "tr A-Za-z N-ZA-Mn-za-m <" && |