git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC PATCH 3/3] Support fetching from foreign VCSes

From
Johan Herland <johan@herland.net>
Date
Feb 1, 2009, 02:20 UTC
Message-ID
<200902010320.28128.johan@herland.net>
In-Reply-To
<alpine.LNX.1.00.0901110335520.19665@iabervon.org>
On Sunday 11 January 2009, Daniel Barkalow wrote:
> This supports a useful subset of the usual fetch logic, mostly in the
> config file.
Hi,

I love the idea of this patch series, and have started working on a CVS backend for this. I have a question though...

Show 16 quoted lines
> Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
> ---
>  builtin-fetch.c |  135
> +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed,
> 132 insertions(+), 3 deletions(-)
>
> diff --git a/builtin-fetch.c b/builtin-fetch.c
> index 7b46f8f..14e037e 100644
> --- a/builtin-fetch.c
> +++ b/builtin-fetch.c
> @@ -614,6 +614,136 @@ static void set_option(const char *name, const char
> *value) name, transport->url);
>  }
>
> +static struct ref *list_foreign(struct remote *remote)
> +{
[...]
> +}
> +
> +static int import_foreign(struct remote *remote, struct ref *refs)
> +{
[...]
Show 5 quoted lines
> +}
> +
> +static int fetch_foreign(struct remote *remote)
> +{
> +	struct ref *remote_refs = list_foreign(remote);
We retrieve a list of all refs available at the given remote...
Show 7 quoted lines
> +	struct ref *ref_map = NULL;
> +	struct ref *rm;
> +	struct ref **tail = &ref_map;
> +	struct branch *branch;
> +	int i;
> +
> +	int exit_code = import_foreign(remote, remote_refs);
...and then we start fetching _all_ the refs returned by list_foreign().

When I call "git fetch <vcs-remote> <ref>", I expect _only_ <ref> to be fetched from the remote, but it seems the above code doesn't even concern itself with the ref(s) specified on the "git fetch" command-line

I'm not even sure why list_foreign() should be called in this case (except, maybe, to verify the existence of <ref> before attempting to fetch it).

AFAICS list_foreign() is only needed by "git fetch" if <ref> contains a wildcard (like the default refspec: +refs/heads/*:refs/remotes/<remote>/*).

...or have I misunderstood something fundamental about how this is going to work?

Have fun! :)
...Johan
-- 
Johan Herland, <johan@herland.net>
www.herland.net
Previous: Daniel BarkalowNext: Daniel Barkalow
Message 8 of 9 in “Support fetching from foreign VCSes”
  1. 3/3 Support fetching from foreign VCSesDaniel Barkalow, Jan 11, 2009
  2. Junio C HamanoJan 12, 2009
  3. Daniel BarkalowJan 12, 2009
  4. Shawn O. PearceJan 12, 2009
  5. Daniel BarkalowJan 12, 2009
  6. Johannes SchindelinJan 12, 2009
  7. Daniel BarkalowJan 12, 2009
  8. Johan HerlandFeb 1, 2009
  9. Daniel BarkalowFeb 1, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.