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

Re: [PATCH] doc: explain why file: URLs and bundles don't mix

From
Alyssa Ross <hi@alyssa.is>
Date
May 13, 2019, 16:54 UTC
Message-ID
<20190513165140.vq225fscfvemol7k@x220.qyliss.net>
In-Reply-To
<xmqqv9yebwzp.fsf@gitster-ct.c.googlers.com>
Show 20 quoted lines
> > +- When cloning, the former implies --local option. See
> > +  linkgit:git-clone[1] for details.
> > +
> > +- The latter is implemented using linkgit:git-upload-pack[1], which
> > +  expects its repository to be a directory, and therefore does not
> > +  work for bundles (see linkgit:git-bundle[1]).
>
> Hmm, I do not think this is quite true.
>
> If "git clone /path/to/repo.bndl" implied --local, we would end up
> trying to hardlink into /path/to/repo.bndl/objects and would fail.
>
> I think what is closer to the reaility is that we check if the
> source is a bundle when the local filesystem path is used and try to
> clone from the bundle, before using the local filesystem path as a
> directory we can "clone --local" from.  On the other hand, when the
> <scheme>://<path> syntax is used, we do not even bother seeing if
> the named resource is a bundle, or if --local optimization is
> possible (because we do not bother seeing if the named resource is a
> local filesystem entity, either).
Would the following work better for you?

When cloning, the former will check to see if the source is a bundle. If it is, it will clone from the bundle, otherwise it will behave as if given --local. The latter performs neither of these checks, and therefore does not support bundles.

Show 7 quoted lines
> A possibly interesting tangent to think about is what would happen
> if we slightly tweak the above design.  What it would require for
> the code to take "git clone https://site/repo.bndl", realize that
> the named resource is a bundle file, curl/wget it and clone from
> that downloaded bundle?  And if it is feasible to implement, would
> it even be a good idea to begin with?  I do not have a ready answer
> to either of these questions myself.

I was very surprised to find that cloning from a bundle didn't even work with a file URL, especially since the documentation seemed to imply that it should. I assumed that file URLs not supporting bundles was an oversight, and made some attempt to read the code with a view to fixing it. Once I realised that file URLs went through a completely different code path to paths, I decided it was better to just document things as they were.

I think it would be nice if, at least for file URLs, bundles were supported. I doubt supporting cloning a bundle over a network would inherently cause problems (although I'm by no means qualified to make such an assessment) -- if it's not clear whether it's a good idea to do so, it could always be implemented without being advertised.

Previous: Junio C HamanoNext: Jeff King
Message 3 of 5 in “doc: explain why file: URLs and bundles don't mix”
  1. doc: explain why file: URLs and bundles don't mixAlyssa Ross, May 13, 2019
  2. Junio C HamanoMay 13, 2019
  3. Alyssa RossMay 13, 2019
  4. Jeff KingMay 14, 2019
  5. Jeff KingMay 14, 2019

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.