Skip to content

Commit

Permalink
rev_list_insert_ref_oid(): new function, taking an object_oid
Browse files Browse the repository at this point in the history
This function can be used with for_each_ref() without having to be
wrapped.

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>
  • Loading branch information
Michael Haggerty authored and Junio C Hamano committed May 25, 2015
1 parent 6e20a51 commit b1b49c6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions fetch-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ static int rev_list_insert_ref(const char *refname, const unsigned char *sha1, i
return 0;
}

static int rev_list_insert_ref_oid(const char *refname, const struct object_id *oid,
int flag, void *cb_data)
{
return rev_list_insert_ref(refname, oid->hash, flag, cb_data);
}

static int clear_marks(const char *refname, const struct object_id *oid,
int flag, void *cb_data)
{
Expand Down Expand Up @@ -257,16 +263,14 @@ static int find_common(struct fetch_pack_args *args,
int got_ready = 0;
struct strbuf req_buf = STRBUF_INIT;
size_t state_len = 0;
struct each_ref_fn_sha1_adapter wrapped_rev_list_insert_ref =
{rev_list_insert_ref, NULL};

if (args->stateless_rpc && multi_ack == 1)
die("--stateless-rpc requires multi_ack_detailed");
if (marked)
for_each_ref(clear_marks, NULL);
marked = 1;

for_each_ref(each_ref_fn_adapter, &wrapped_rev_list_insert_ref);
for_each_ref(rev_list_insert_ref_oid, NULL);
for_each_alternate_ref(insert_one_alternate_ref, NULL);

fetching = 0;
Expand Down

0 comments on commit b1b49c6

Please sign in to comment.