append_ref(): rewrite to take an object_id argument
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty committed
May 25, 2015 at 18:38 UTC
a55ce971857c5fcaf9d390c826de6a0e5c6a74eb
1 file changed
+3
-5
builtin/branch.c
+3
-5
@@ -328,7 +328,7 @@ static int match_patterns(const char **pattern, const char *refname)
328
return 0;
329
}
330
331
-static int append_ref(const char *refname, const unsigned char *sha1, int flags, void *cb_data)
331
+static int append_ref(const char *refname, const struct object_id *oid, int flags, void *cb_data)
332
{
333
struct append_ref_cb *cb = (struct append_ref_cb *)(cb_data);
334
struct ref_list *ref_list = cb->ref_list;
@@ -365,7 +365,7 @@ static int append_ref(const char *refname, const unsigned char *sha1, int flags,
365
366
commit = NULL;
367
if (ref_list->verbose || ref_list->with_commit || merge_filter != NO_FILTER) {
368
- commit = lookup_commit_reference_gently(sha1, 1);
368
+ commit = lookup_commit_reference_gently(oid->hash, 1);
369
if (!commit) {
370
cb->ret = error(_("branch '%s' does not point at a commit"), refname);
371
return 0;
@@ -631,8 +631,6 @@ static int print_ref_list(int kinds, int detached, int verbose, int abbrev, stru
631
int i;
632
struct append_ref_cb cb;
633
struct ref_list ref_list;
634
- struct each_ref_fn_sha1_adapter wrapped_append_ref =
635
- {append_ref, &cb};
634
635
memset(&ref_list, 0, sizeof(ref_list));
636
ref_list.kinds = kinds;
@@ -644,7 +642,7 @@ static int print_ref_list(int kinds, int detached, int verbose, int abbrev, stru
642
cb.ref_list = &ref_list;
643
cb.pattern = pattern;
644
cb.ret = 0;
647
- for_each_rawref(each_ref_fn_adapter, &wrapped_append_ref);
645
+ for_each_rawref(append_ref, &cb);
646
if (merge_filter != NO_FILTER) {
647
struct commit *filter;
648
filter = lookup_commit_reference_gently(merge_filter_ref, 0);