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:
13
remote.c
13
remote.c
@ -2168,7 +2168,8 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int one_local_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data)
|
||||
static int one_local_ref(const char *refname, const struct object_id *oid,
|
||||
int flag, void *cb_data)
|
||||
{
|
||||
struct ref ***local_tail = cb_data;
|
||||
struct ref *ref;
|
||||
@ -2180,7 +2181,7 @@ static int one_local_ref(const char *refname, const unsigned char *sha1, int fla
|
||||
|
||||
len = strlen(refname) + 1;
|
||||
ref = xcalloc(1, sizeof(*ref) + len);
|
||||
hashcpy(ref->new_sha1, sha1);
|
||||
hashcpy(ref->new_sha1, oid->hash);
|
||||
memcpy(ref->name, refname, len);
|
||||
**local_tail = ref;
|
||||
*local_tail = &ref->next;
|
||||
@ -2190,6 +2191,7 @@ static int one_local_ref(const char *refname, const unsigned char *sha1, int fla
|
||||
struct ref *get_local_heads(void)
|
||||
{
|
||||
struct ref *local_refs = NULL, **local_tail = &local_refs;
|
||||
|
||||
for_each_ref(one_local_ref, &local_tail);
|
||||
return local_refs;
|
||||
}
|
||||
@ -2242,8 +2244,8 @@ struct stale_heads_info {
|
||||
int ref_count;
|
||||
};
|
||||
|
||||
static int get_stale_heads_cb(const char *refname,
|
||||
const unsigned char *sha1, int flags, void *cb_data)
|
||||
static int get_stale_heads_cb(const char *refname, const struct object_id *oid,
|
||||
int flags, void *cb_data)
|
||||
{
|
||||
struct stale_heads_info *info = cb_data;
|
||||
struct string_list matches = STRING_LIST_INIT_DUP;
|
||||
@ -2272,7 +2274,7 @@ static int get_stale_heads_cb(const char *refname,
|
||||
|
||||
if (stale) {
|
||||
struct ref *ref = make_linked_ref(refname, &info->stale_refs_tail);
|
||||
hashcpy(ref->new_sha1, sha1);
|
||||
hashcpy(ref->new_sha1, oid->hash);
|
||||
}
|
||||
|
||||
clean_exit:
|
||||
@ -2285,6 +2287,7 @@ struct ref *get_stale_heads(struct refspec *refs, int ref_count, struct ref *fet
|
||||
struct ref *ref, *stale_refs = NULL;
|
||||
struct string_list ref_names = STRING_LIST_INIT_NODUP;
|
||||
struct stale_heads_info info;
|
||||
|
||||
info.ref_names = &ref_names;
|
||||
info.stale_refs_tail = &stale_refs;
|
||||
info.refs = refs;
|
||||
|
||||
Reference in New Issue
Block a user