Skip to content

Commit a55ce97

Browse files
mhaggergitster
authored andcommitted
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>
1 parent eed2514 commit a55ce97

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

builtin/branch.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ static int match_patterns(const char **pattern, const char *refname)
328328
return 0;
329329
}
330330

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)
332332
{
333333
struct append_ref_cb *cb = (struct append_ref_cb *)(cb_data);
334334
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,
365365

366366
commit = NULL;
367367
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);
369369
if (!commit) {
370370
cb->ret = error(_("branch '%s' does not point at a commit"), refname);
371371
return 0;
@@ -631,8 +631,6 @@ static int print_ref_list(int kinds, int detached, int verbose, int abbrev, stru
631631
int i;
632632
struct append_ref_cb cb;
633633
struct ref_list ref_list;
634-
struct each_ref_fn_sha1_adapter wrapped_append_ref =
635-
{append_ref, &cb};
636634

637635
memset(&ref_list, 0, sizeof(ref_list));
638636
ref_list.kinds = kinds;
@@ -644,7 +642,7 @@ static int print_ref_list(int kinds, int detached, int verbose, int abbrev, stru
644642
cb.ref_list = &ref_list;
645643
cb.pattern = pattern;
646644
cb.ret = 0;
647-
for_each_rawref(each_ref_fn_adapter, &wrapped_append_ref);
645+
for_each_rawref(append_ref, &cb);
648646
if (merge_filter != NO_FILTER) {
649647
struct commit *filter;
650648
filter = lookup_commit_reference_gently(merge_filter_ref, 0);

0 commit comments

Comments
 (0)