Re: [PATCH 7/7] Factor ref updating out of fetch_with_import
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Oct 29, 2009, 14:22 UTC
- Message-ID
- <20091029142232.GS10505@spearce.org>
- In-Reply-To
- <1256798426-21816-8-git-send-email-srabbelier@gmail.com>
Sverre Rabbelier <srabbelier@gmail.com> wrote:
> Also allow the new update_refs to actually update the refs set, this > way the remote helper can set the value of previously unknown refs.
...
Show 12 quoted lines
> diff --git a/builtin-clone.c b/builtin-clone.c
> index f281756..768668d 100644
> --- a/builtin-clone.c
> +++ b/builtin-clone.c
> @@ -512,6 +512,13 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
> if (refs) {
> struct ref *ref_cpy = copy_ref_list(refs);
> transport_fetch_refs(transport, ref_cpy);
> + if (transport->update_refs)
> + {
> + ref_cpy = copy_ref_list(refs);
> + transport->update_refs(transport, ref_cpy);Please define a transport_update_refs wrapper function to implement this method invocation on the transport instance. Callers should not be reaching into the struct transport directly.
Show 12 quoted lines
> diff --git a/builtin-fetch.c b/builtin-fetch.c
> index 63a4ff0..3aaac47 100644
> --- a/builtin-fetch.c
> +++ b/builtin-fetch.c
> @@ -479,7 +479,11 @@ static int fetch_refs(struct transport *transport, struct ref *ref_map)
> {
> int ret = quickfetch(ref_map);
> if (ret)
> + {
> ret = transport_fetch_refs(transport, ref_map);
> + if (transport->update_refs)
> + transport->update_refs(transport, ref_map);I certainly have to wonder... if this is done in both fetch and clone, why isn't it just part of fetch_refs?
Show 9 quoted lines
> diff --git a/transport-helper.c b/transport-helper.c > index a361366..9a98fae 100644 > --- a/transport-helper.c > +++ b/transport-helper.c > @@ -264,5 +271,6 @@ int transport_helper_init(struct transport *transport, const char *name) > transport->get_refs_list = get_refs_list; > transport->fetch = fetch; > transport->disconnect = release_helper; > + transport->update_refs = update_refs;
Please set this before the disconnect method (move it up one line).
-- Shawn.