Update callbacks to take the proper parameters and use struct object_id elsewhere in the callbacks.
Signed-off-by: brian m. carlson <sand...@crustytoothpaste.net> --- builtin/replace.c | 14 +++++++------- refs.c | 4 ++-- refs.h | 2 +- replace_object.c | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/builtin/replace.c b/builtin/replace.c index 85d39b5..c873180 100644 --- a/builtin/replace.c +++ b/builtin/replace.c @@ -35,7 +35,7 @@ struct show_data { enum replace_format format; }; -static int show_reference(const char *refname, const unsigned char *sha1, +static int show_reference(const char *refname, const struct object_id *oid, int flag, void *cb_data) { struct show_data *data = cb_data; @@ -44,19 +44,19 @@ static int show_reference(const char *refname, const unsigned char *sha1, if (data->format == REPLACE_FORMAT_SHORT) printf("%s\n", refname); else if (data->format == REPLACE_FORMAT_MEDIUM) - printf("%s -> %s\n", refname, sha1_to_hex(sha1)); + printf("%s -> %s\n", refname, oid_to_hex(oid)); else { /* data->format == REPLACE_FORMAT_LONG */ - unsigned char object[20]; + struct object_id object; enum object_type obj_type, repl_type; - if (get_sha1(refname, object)) + if (get_sha1(refname, object.hash)) return error("Failed to resolve '%s' as a valid ref.", refname); - obj_type = sha1_object_info(object, NULL); - repl_type = sha1_object_info(sha1, NULL); + obj_type = sha1_object_info(object.hash, NULL); + repl_type = sha1_object_info(oid->hash, NULL); printf("%s (%s) -> %s (%s)\n", refname, typename(obj_type), - sha1_to_hex(sha1), typename(repl_type)); + oid_to_hex(oid), typename(repl_type)); } } diff --git a/refs.c b/refs.c index 4d07dec..0d9b340 100644 --- a/refs.c +++ b/refs.c @@ -2010,9 +2010,9 @@ int for_each_remote_ref_submodule(const char *submodule, each_ref_fn_oid fn, voi return for_each_ref_in_submodule(submodule, "refs/remotes/", fn, cb_data); } -int for_each_replace_ref(each_ref_fn fn, void *cb_data) +int for_each_replace_ref(each_ref_fn_oid fn, void *cb_data) { - return do_for_each_ref(&ref_cache, "refs/replace/", fn, 13, 0, cb_data); + return do_for_each_ref_oid(&ref_cache, "refs/replace/", fn, 13, 0, cb_data); } int head_ref_namespaced(each_ref_fn fn, void *cb_data) diff --git a/refs.h b/refs.h index 2c78450..951e465 100644 --- a/refs.h +++ b/refs.h @@ -101,7 +101,7 @@ extern int for_each_ref_in(const char *, each_ref_fn_oid, void *); extern int for_each_tag_ref(each_ref_fn_oid, void *); extern int for_each_branch_ref(each_ref_fn_oid, void *); extern int for_each_remote_ref(each_ref_fn_oid, void *); -extern int for_each_replace_ref(each_ref_fn, void *); +extern int for_each_replace_ref(each_ref_fn_oid, void *); extern int for_each_glob_ref(each_ref_fn_oid, const char *pattern, void *); extern int for_each_glob_ref_in(each_ref_fn_oid, const char *pattern, const char* prefix, void *); diff --git a/replace_object.c b/replace_object.c index 0ab2dc1..f0b39f0 100644 --- a/replace_object.c +++ b/replace_object.c @@ -53,7 +53,7 @@ static int register_replace_object(struct replace_object *replace, } static int register_replace_ref(const char *refname, - const unsigned char *sha1, + const struct object_id *oid, int flag, void *cb_data) { /* Get sha1 from refname */ @@ -68,7 +68,7 @@ static int register_replace_ref(const char *refname, } /* Copy sha1 from the read ref */ - hashcpy(repl_obj->replacement, sha1); + hashcpy(repl_obj->replacement, oid->hash); /* Register new object */ if (register_replace_object(repl_obj, 1)) -- 2.2.1.209.g41e5f3a -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html