author | Junio C Hamano <gitster@pobox.com> | |
Wed, 23 Mar 2011 04:37:53 +0000 (21:37 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 23 Mar 2011 04:37:53 +0000 (21:37 -0700) |
* jc/maint-fetch-alt:
fetch-pack: objects in our alternates are available to us
refs_from_alternate: helper to use refs from alternates
Conflicts:
builtin/receive-pack.c
fetch-pack: objects in our alternates are available to us
refs_from_alternate: helper to use refs from alternates
Conflicts:
builtin/receive-pack.c
1 | 2 | |||
---|---|---|---|---|
builtin/fetch-pack.c | patch | | diff1 | | diff2 | | blob | history |
builtin/receive-pack.c | patch | | diff1 | | diff2 | | blob | history |
transport.c | patch | | diff1 | | diff2 | | blob | history |
diff --cc builtin/fetch-pack.c
Simple merge
diff --cc builtin/receive-pack.c
Simple merge
diff --cc transport.c
index f1c07816e01bb0b1ad93d7665b1374e8cd36e6cb,3dfbc6a79c402bac5e18de97a12c131b556597c4..a02f79aae3d91ea4109d21a9ed9ca2d962125375
--- 1/transport.c
--- 2/transport.c
+++ b/transport.c
literal_copy:
return xstrdup(url);
}
- other = xstrdup(make_absolute_path(e->base));
+
+ int refs_from_alternate_cb(struct alternate_object_database *e, void *cb)
+ {
+ char *other;
+ size_t len;
+ struct remote *remote;
+ struct transport *transport;
+ const struct ref *extra;
+ alternate_ref_fn *ref_fn = cb;
+
+ e->name[-1] = '\0';
++ other = xstrdup(real_path(e->base));
+ e->name[-1] = '/';
+ len = strlen(other);
+
+ while (other[len-1] == '/')
+ other[--len] = '\0';
+ if (len < 8 || memcmp(other + len - 8, "/objects", 8))
+ return 0;
+ /* Is this a git repository with refs? */
+ memcpy(other + len - 8, "/refs", 6);
+ if (!is_directory(other))
+ return 0;
+ other[len - 8] = '\0';
+ remote = remote_get(other);
+ transport = transport_get(remote, other);
+ for (extra = transport_get_remote_refs(transport);
+ extra;
+ extra = extra->next)
+ ref_fn(extra, NULL);
+ transport_disconnect(transport);
+ free(other);
+ return 0;
+ }