Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
remote: rewrite functions to take object_id arguments
author
Michael Haggerty
<mhagger@alum.mit.edu>
Mon, 25 May 2015 18:39:01 +0000
(18:39 +0000)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 25 May 2015 19:19:34 +0000
(12:19 -0700)
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>
remote.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
635170f
)
diff --git
a/remote.c
b/remote.c
index 6d66ec15f48de998d33bea250e616844a466ad1d..1623eae2ff4537e3566c067ce745945744648a93 100644
(file)
--- a/
remote.c
+++ b/
remote.c
@@
-2024,7
+2024,8
@@
int format_tracking_info(struct branch *branch, struct strbuf *sb)
return 1;
}
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;
{
struct ref ***local_tail = cb_data;
struct ref *ref;
@@
-2036,7
+2037,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);
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;
memcpy(ref->name, refname, len);
**local_tail = ref;
*local_tail = &ref->next;
@@
-2046,10
+2047,8
@@
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;
struct ref *get_local_heads(void)
{
struct ref *local_refs = NULL, **local_tail = &local_refs;
- struct each_ref_fn_sha1_adapter wrapped_one_local_ref =
- {one_local_ref, &local_tail};
- for_each_ref(
each_ref_fn_adapter, &wrapped_one_local_ref
);
+ for_each_ref(
one_local_ref, &local_tail
);
return local_refs;
}
return local_refs;
}
@@
-2101,8
+2100,8
@@
struct stale_heads_info {
int ref_count;
};
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;
{
struct stale_heads_info *info = cb_data;
struct string_list matches = STRING_LIST_INIT_DUP;
@@
-2131,7
+2130,7
@@
static int get_stale_heads_cb(const char *refname,
if (stale) {
struct ref *ref = make_linked_ref(refname, &info->stale_refs_tail);
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:
}
clean_exit:
@@
-2144,8
+2143,6
@@
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;
struct ref *ref, *stale_refs = NULL;
struct string_list ref_names = STRING_LIST_INIT_NODUP;
struct stale_heads_info info;
- struct each_ref_fn_sha1_adapter wrapped_get_stale_heads_cb =
- {get_stale_heads_cb, &info};
info.ref_names = &ref_names;
info.stale_refs_tail = &stale_refs;
info.ref_names = &ref_names;
info.stale_refs_tail = &stale_refs;
@@
-2154,7
+2151,7
@@
struct ref *get_stale_heads(struct refspec *refs, int ref_count, struct ref *fet
for (ref = fetch_map; ref; ref = ref->next)
string_list_append(&ref_names, ref->name);
string_list_sort(&ref_names);
for (ref = fetch_map; ref; ref = ref->next)
string_list_append(&ref_names, ref->name);
string_list_sort(&ref_names);
- for_each_ref(
each_ref_fn_adapter, &wrapped_get_stale_heads_cb
);
+ for_each_ref(
get_stale_heads_cb, &info
);
string_list_clear(&ref_names, 0);
return stale_refs;
}
string_list_clear(&ref_names, 0);
return stale_refs;
}