Commit walkers need to know the SHA-1 name of any objects they
have been asked to fetch while the native pack transport only
wants to know the names of the remote refs as the remote side
must do the name->SHA-1 translation.
Since we only have three fetch implementations and one of them
(bundle) doesn't even need the name information we can reduce
the code required to perform a fetch by having just one function
and passing of the filtered list of refs to be fetched. Each
transport can then obtain the information it needs from that ref
array to construct its own internal operation state.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Conflicts:
transport.c
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Shawn O. Pearce18 years agocommitted byJunio C Hamano
static int fetch_objs_via_walker(const struct transport *transport,
int nr_objs, char **objs)
int nr_objs, struct ref **to_fetch)
{
char *dest = xstrdup(transport->url);
struct walker *walker = transport->data;
char **objs = xmalloc(nr_objs * sizeof(*objs));
int i;
walker->get_all = 1;
walker->get_tree = 1;
@ -21,9 +23,15 @@ static int fetch_objs_via_walker(const struct transport *transport,
@@ -21,9 +23,15 @@ static int fetch_objs_via_walker(const struct transport *transport,
@ -320,14 +328,13 @@ static int fetch_refs_via_pack(const struct transport *transport,
@@ -320,14 +328,13 @@ static int fetch_refs_via_pack(const struct transport *transport,
setup_fetch_pack(&args);
for (i = 0; i < nr_heads; i++)
heads[i] = xstrdup(to_fetch[i]->name);
refs = fetch_pack(dest, nr_heads, heads);
// ???? check that refs got everything?
/* free the memory used for the refs list ... */
for (i = 0; i < nr_heads; i++)
free(heads[i]);
free_refs(refs);
free(dest);
return 0;
}
@ -379,8 +386,7 @@ static int git_transport_push(struct transport *transport, int refspec_nr, const
@@ -379,8 +386,7 @@ static int git_transport_push(struct transport *transport, int refspec_nr, const