Merge branch 'bc/object-id'
for_each_ref() callback functions were taught to name the objects not with "unsigned char sha1[20]" but with "struct object_id". * bc/object-id: (56 commits) struct ref_lock: convert old_sha1 member to object_id warn_if_dangling_symref(): convert local variable "junk" to object_id each_ref_fn_adapter(): remove adapter rev_list_insert_ref(): remove unneeded arguments rev_list_insert_ref_oid(): new function, taking an object_oid mark_complete(): remove unneeded arguments mark_complete_oid(): new function, taking an object_oid clear_marks(): rewrite to take an object_id argument mark_complete(): rewrite to take an object_id argument send_ref(): convert local variable "peeled" to object_id upload-pack: rewrite functions to take object_id arguments find_symref(): convert local variable "unused" to object_id find_symref(): rewrite to take an object_id argument write_one_ref(): rewrite to take an object_id argument write_refs_to_temp_dir(): convert local variable sha1 to object_id submodule: rewrite to take an object_id argument shallow: rewrite functions to take object_id arguments handle_one_ref(): rewrite to take an object_id argument add_info_ref(): rewrite to take an object_id argument handle_one_reflog(): rewrite to take an object_id argument ...
This commit is contained in:
29
fetch-pack.c
29
fetch-pack.c
@ -65,7 +65,7 @@ static void rev_list_push(struct commit *commit, int mark)
|
||||
}
|
||||
}
|
||||
|
||||
static int rev_list_insert_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data)
|
||||
static int rev_list_insert_ref(const char *refname, const unsigned char *sha1)
|
||||
{
|
||||
struct object *o = deref_tag(parse_object(sha1), refname, 0);
|
||||
|
||||
@ -75,9 +75,16 @@ static int rev_list_insert_ref(const char *refname, const unsigned char *sha1, i
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int clear_marks(const char *refname, const unsigned char *sha1, int flag, void *cb_data)
|
||||
static int rev_list_insert_ref_oid(const char *refname, const struct object_id *oid,
|
||||
int flag, void *cb_data)
|
||||
{
|
||||
struct object *o = deref_tag(parse_object(sha1), refname, 0);
|
||||
return rev_list_insert_ref(refname, oid->hash);
|
||||
}
|
||||
|
||||
static int clear_marks(const char *refname, const struct object_id *oid,
|
||||
int flag, void *cb_data)
|
||||
{
|
||||
struct object *o = deref_tag(parse_object(oid->hash), refname, 0);
|
||||
|
||||
if (o && o->type == OBJ_COMMIT)
|
||||
clear_commit_marks((struct commit *)o,
|
||||
@ -231,7 +238,7 @@ static void send_request(struct fetch_pack_args *args,
|
||||
|
||||
static void insert_one_alternate_ref(const struct ref *ref, void *unused)
|
||||
{
|
||||
rev_list_insert_ref(NULL, ref->old_sha1, 0, NULL);
|
||||
rev_list_insert_ref(NULL, ref->old_sha1);
|
||||
}
|
||||
|
||||
#define INITIAL_FLUSH 16
|
||||
@ -268,7 +275,7 @@ static int find_common(struct fetch_pack_args *args,
|
||||
for_each_ref(clear_marks, NULL);
|
||||
marked = 1;
|
||||
|
||||
for_each_ref(rev_list_insert_ref, NULL);
|
||||
for_each_ref(rev_list_insert_ref_oid, NULL);
|
||||
for_each_alternate_ref(insert_one_alternate_ref, NULL);
|
||||
|
||||
fetching = 0;
|
||||
@ -471,7 +478,7 @@ done:
|
||||
|
||||
static struct commit_list *complete;
|
||||
|
||||
static int mark_complete(const char *refname, const unsigned char *sha1, int flag, void *cb_data)
|
||||
static int mark_complete(const unsigned char *sha1)
|
||||
{
|
||||
struct object *o = parse_object(sha1);
|
||||
|
||||
@ -492,6 +499,12 @@ static int mark_complete(const char *refname, const unsigned char *sha1, int fla
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mark_complete_oid(const char *refname, const struct object_id *oid,
|
||||
int flag, void *cb_data)
|
||||
{
|
||||
return mark_complete(oid->hash);
|
||||
}
|
||||
|
||||
static void mark_recent_complete_commits(struct fetch_pack_args *args,
|
||||
unsigned long cutoff)
|
||||
{
|
||||
@ -570,7 +583,7 @@ static void filter_refs(struct fetch_pack_args *args,
|
||||
|
||||
static void mark_alternate_complete(const struct ref *ref, void *unused)
|
||||
{
|
||||
mark_complete(NULL, ref->old_sha1, 0, NULL);
|
||||
mark_complete(ref->old_sha1);
|
||||
}
|
||||
|
||||
static int everything_local(struct fetch_pack_args *args,
|
||||
@ -605,7 +618,7 @@ static int everything_local(struct fetch_pack_args *args,
|
||||
}
|
||||
|
||||
if (!args->depth) {
|
||||
for_each_ref(mark_complete, NULL);
|
||||
for_each_ref(mark_complete_oid, NULL);
|
||||
for_each_alternate_ref(mark_alternate_complete, NULL);
|
||||
commit_list_sort_by_date(&complete);
|
||||
if (cutoff)
|
||||
|
Reference in New Issue
Block a user