summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorMichael J Gruber <git@drmicha.warpmail.net>2013-05-10 17:10:13 +0200
committerJunio C Hamano <gitster@pobox.com>2013-05-10 10:27:16 -0700
commit3ac21617b0f56dd76be3bbaa663bf0fff7f3095d (patch)
tree48d11779889306fce02c2bfc3acd5f5ddf603d94 /builtin
parent083b99310978c6768d8e954c9bab1d3692a515a1 (diff)
downloadgit-3ac21617b0f56dd76be3bbaa663bf0fff7f3095d.tar.gz
cat-file: do not die on --textconv without textconv filters
When a command is supposed to use textconv filters (by default or with "--textconv") and none are configured then the blob is output without conversion; the only exception to this rule is "cat-file --textconv". Make it behave like the rest of textconv aware commands. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/cat-file.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index 40f87b4649..fbaa1213f1 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -115,6 +115,14 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)
case 'e':
return !has_sha1_file(sha1);
+ case 'c':
+ if (!obj_context.path[0])
+ die("git cat-file --textconv %s: <object> must be <sha1:path>",
+ obj_name);
+
+ if (textconv_object(obj_context.path, obj_context.mode, sha1, 1, &buf, &size))
+ break;
+
case 'p':
type = sha1_object_info(sha1, NULL);
if (type < 0)
@@ -141,16 +149,6 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)
/* otherwise just spit out the data */
break;
- case 'c':
- if (!obj_context.path[0])
- die("git cat-file --textconv %s: <object> must be <sha1:path>",
- obj_name);
-
- if (!textconv_object(obj_context.path, obj_context.mode, sha1, 1, &buf, &size))
- die("git cat-file --textconv: unable to run textconv on %s",
- obj_name);
- break;
-
case 0:
if (type_from_string(exp_type) == OBJ_BLOB) {
unsigned char blob_sha1[20];