summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 36cfda1)
raw | patch | inline | side by side (parent: 36cfda1)
author | Junio C Hamano <gitster@pobox.com> | |
Fri, 11 Mar 2011 19:53:52 +0000 (11:53 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 17 Mar 2011 23:18:55 +0000 (16:18 -0700) |
Use the helper function split from the receiving end of "git push" to
allow the same optimization on the receiving end of "git fetch".
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
allow the same optimization on the receiving end of "git fetch".
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
builtin/fetch-pack.c | patch | blob | history | |
t/t5501-fetch-push-alternates.sh | patch | blob | history |
diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
index b9994139345834a58b08a5ce57cf59c124e21760..4c25968e16b75793a4938bcdf70b937ae3cba923 100644 (file)
--- a/builtin/fetch-pack.c
+++ b/builtin/fetch-pack.c
#include "fetch-pack.h"
#include "remote.h"
#include "run-command.h"
+#include "transport.h"
static int transfer_unpack_limit = -1;
static int fetch_unpack_limit = -1;
safe_write(fd, buf->buf, buf->len);
}
+static void insert_one_alternate_ref(const struct ref *ref, void *unused)
+{
+ rev_list_insert_ref(NULL, ref->old_sha1, 0, NULL);
+}
+
+static void insert_alternate_refs(void)
+{
+ foreach_alt_odb(refs_from_alternate_cb, insert_one_alternate_ref);
+}
+
static int find_common(int fd[2], unsigned char *result_sha1,
struct ref *refs)
{
marked = 1;
for_each_ref(rev_list_insert_ref, NULL);
+ insert_alternate_refs();
fetching = 0;
for ( ; refs ; refs = refs->next) {
index 16a467654c7353d2faf64a6a3131c27e99262978..b5ced8483a8fc663eb53b514bbb56df92f217deb 100755 (executable)
test_cmp one.count receiver.count
'
-test_expect_failure 'fetching from a repository with the same alternate' '
+test_expect_success 'fetching from a repository with the same alternate' '
(
cd fetcher &&
git fetch ../one master:refs/heads/it &&