diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-03-16 17:53:08 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-03-16 17:53:08 -0700 |
commit | 430883a70c79614e52279f2800a9a383ffc68fe5 (patch) | |
tree | 84a13eeaaa7f7231a55f02cb48d42c5951197fa5 /builtin/cat-file.c | |
parent | 8d1ae40bae1568be25dcc55679f1635b90d53d1b (diff) | |
parent | 6aea6baeb3ece6c832dbdf1deed09f41aebf85c2 (diff) | |
download | git-430883a70c79614e52279f2800a9a383ffc68fe5.tar.gz |
Merge branch 'ab/object-file-api-updates'
Object-file API shuffling.
* ab/object-file-api-updates:
object-file API: pass an enum to read_object_with_reference()
object-file.c: add a literal version of write_object_file_prepare()
object-file API: have hash_object_file() take "enum object_type"
object API: rename hash_object_file_literally() to write_*()
object-file API: split up and simplify check_object_signature()
object API users + docs: check <0, not !0 with check_object_signature()
object API docs: move check_object_signature() docs to cache.h
object API: correct "buf" v.s. "map" mismatch in *.c and *.h
object-file API: have write_object_file() take "enum object_type"
object-file API: add a format_object_header() function
object-file API: return "void", not "int" from hash_object_file()
object-file.c: split up declaration of unrelated variables
Diffstat (limited to 'builtin/cat-file.c')
-rw-r--r-- | builtin/cat-file.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/builtin/cat-file.c b/builtin/cat-file.c index e75e110302..0663661c0b 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -156,7 +156,10 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name, break; case 0: - if (type_from_string(exp_type) == OBJ_BLOB) { + { + enum object_type exp_type_id = type_from_string(exp_type); + + if (exp_type_id == OBJ_BLOB) { struct object_id blob_oid; if (oid_object_info(the_repository, &oid, NULL) == OBJ_TAG) { char *buffer = read_object_file(&oid, &type, @@ -178,10 +181,10 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name, * fall-back to the usual case. */ } - buf = read_object_with_reference(the_repository, - &oid, exp_type, &size, NULL); + buf = read_object_with_reference(the_repository, &oid, + exp_type_id, &size, NULL); break; - + } default: die("git cat-file: unknown option: %s", exp_type); } |