diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-05-23 14:38:16 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-05-23 14:38:16 +0900 |
commit | fcb6df325468a7ae12949ab80dcd37772b9b1fbf (patch) | |
tree | 7ae13a8a1c4f7b417403b6f7f64f34a9565dbab2 /builtin/replace.c | |
parent | Merge branch 'cc/perf-aggregate-unknown-option' (diff) | |
parent | cache.h: allow oid_object_info to handle arbitrary repositories (diff) | |
download | tgif-fcb6df325468a7ae12949ab80dcd37772b9b1fbf.tar.xz |
Merge branch 'sb/oid-object-info'
The codepath around object-info API has been taught to take the
repository object (which in turn tells the API which object store
the objects are to be located).
* sb/oid-object-info:
cache.h: allow oid_object_info to handle arbitrary repositories
packfile: add repository argument to cache_or_unpack_entry
packfile: add repository argument to unpack_entry
packfile: add repository argument to read_object
packfile: add repository argument to packed_object_info
packfile: add repository argument to packed_to_object_type
packfile: add repository argument to retry_bad_packed_offset
cache.h: add repository argument to oid_object_info
cache.h: add repository argument to oid_object_info_extended
Diffstat (limited to 'builtin/replace.c')
-rw-r--r-- | builtin/replace.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/builtin/replace.c b/builtin/replace.c index 237ea656cf..14e142d5a8 100644 --- a/builtin/replace.c +++ b/builtin/replace.c @@ -55,8 +55,9 @@ static int show_reference(const char *refname, const struct object_id *oid, if (get_oid(refname, &object)) return error("Failed to resolve '%s' as a valid ref.", refname); - obj_type = oid_object_info(&object, NULL); - repl_type = oid_object_info(oid, NULL); + obj_type = oid_object_info(the_repository, &object, + NULL); + repl_type = oid_object_info(the_repository, oid, NULL); printf("%s (%s) -> %s (%s)\n", refname, type_name(obj_type), oid_to_hex(oid), type_name(repl_type)); @@ -164,8 +165,8 @@ static int replace_object_oid(const char *object_ref, struct ref_transaction *transaction; struct strbuf err = STRBUF_INIT; - obj_type = oid_object_info(object, NULL); - repl_type = oid_object_info(repl, NULL); + obj_type = oid_object_info(the_repository, object, NULL); + repl_type = oid_object_info(the_repository, repl, NULL); if (!force && obj_type != repl_type) die("Objects must be of the same type.\n" "'%s' points to a replaced object of type '%s'\n" @@ -292,7 +293,7 @@ static int edit_and_replace(const char *object_ref, int force, int raw) if (get_oid(object_ref, &old_oid) < 0) die("Not a valid object name: '%s'", object_ref); - type = oid_object_info(&old_oid, NULL); + type = oid_object_info(the_repository, &old_oid, NULL); if (type < 0) die("unable to get object type for %s", oid_to_hex(&old_oid)); |