diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-08-28 19:38:56 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-08-28 19:38:56 -0700 |
commit | 232d4537667e32230c855777444abbe732536ed9 (patch) | |
tree | 33ede70043d40f186a37ce38fcb610abf89b2b03 /transport.c | |
parent | 433233e0b60e55e1afcded413e78c85fde4db722 (diff) | |
parent | 86386829d425a3d3ae6ce713c58328607e50e523 (diff) | |
download | git-232d4537667e32230c855777444abbe732536ed9.tar.gz |
Merge branch 'np/maint-1.6.3-deepen'
* np/maint-1.6.3-deepen:
fix simple deepening of a repo
Conflicts:
t/t5500-fetch-pack.sh
Diffstat (limited to 'transport.c')
-rw-r--r-- | transport.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/transport.c b/transport.c index faee154c38..f7e1663d18 100644 --- a/transport.c +++ b/transport.c @@ -1059,11 +1059,12 @@ const struct ref *transport_get_remote_refs(struct transport *transport) int transport_fetch_refs(struct transport *transport, const struct ref *refs) { int rc; - int nr_heads = 0, nr_alloc = 0; + int nr_heads = 0, nr_alloc = 0, nr_refs = 0; const struct ref **heads = NULL; const struct ref *rm; for (rm = refs; rm; rm = rm->next) { + nr_refs++; if (rm->peer_ref && !hashcmp(rm->peer_ref->old_sha1, rm->old_sha1)) continue; @@ -1071,6 +1072,19 @@ int transport_fetch_refs(struct transport *transport, const struct ref *refs) heads[nr_heads++] = rm; } + if (!nr_heads) { + /* + * When deepening of a shallow repository is requested, + * then local and remote refs are likely to still be equal. + * Just feed them all to the fetch method in that case. + * This condition shouldn't be met in a non-deepening fetch + * (see builtin-fetch.c:quickfetch()). + */ + heads = xmalloc(nr_refs * sizeof(*heads)); + for (rm = refs; rm; rm = rm->next) + heads[nr_heads++] = rm; + } + rc = transport->fetch(transport, nr_heads, heads); free(heads); return rc; |