summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bc98201)
raw | patch | inline | side by side (parent: bc98201)
author | Michael Haggerty <mhagger@alum.mit.edu> | |
Fri, 6 Jan 2012 14:12:33 +0000 (15:12 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 6 Jan 2012 19:26:41 +0000 (11:26 -0800) |
The old code basically did:
generate array of SHA1s for alternate refs
for each unique SHA1 in array:
add_extra_ref(".have", sha1)
for each ref (including real refs and extra refs):
show_ref(refname, sha1)
But there is no need to stuff the alternate refs in extra_refs; we can
call show_ref() directly when iterating over the array, then handle
real refs separately. So change the code to:
generate array of SHA1s for alternate refs
for each unique SHA1 in array:
show_ref(".have", sha1)
for each ref (this now only includes real refs):
show_ref(refname, sha1)
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
generate array of SHA1s for alternate refs
for each unique SHA1 in array:
add_extra_ref(".have", sha1)
for each ref (including real refs and extra refs):
show_ref(refname, sha1)
But there is no need to stuff the alternate refs in extra_refs; we can
call show_ref() directly when iterating over the array, then handle
real refs separately. So change the code to:
generate array of SHA1s for alternate refs
for each unique SHA1 in array:
show_ref(".have", sha1)
for each ref (this now only includes real refs):
show_ref(refname, sha1)
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/receive-pack.c | patch | blob | history |
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index eb878c57317f80dfc8be332683d2b1ef2a67a35b..0bb91d4479c4881b310ac48142642b757448e456 100644 (file)
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -143,9 +143,9 @@ static int show_ref_cb(const char *path, const unsigned char *sha1, int flag, vo
return 0;
}
-static void add_one_alternate_sha1(const unsigned char sha1[20], void *unused)
+static void show_one_alternate_sha1(const unsigned char sha1[20], void *unused)
{
- add_extra_ref(".have", sha1, 0);
+ show_ref(".have", sha1);
}
static void collect_one_alternate_ref(const struct ref *ref, void *data)
{
struct sha1_array sa = SHA1_ARRAY_INIT;
for_each_alternate_ref(collect_one_alternate_ref, &sa);
- sha1_array_for_each_unique(&sa, add_one_alternate_sha1, NULL);
+ sha1_array_for_each_unique(&sa, show_one_alternate_sha1, NULL);
sha1_array_clear(&sa);
for_each_ref(show_ref_cb, NULL);
if (!sent_capabilities)
show_ref("capabilities^{}", null_sha1);
- clear_extra_refs();
/* EOF */
packet_flush(1);