Re: [PATCH] doc: explain why file: URLs and bundles don't mix
- Date: Mon, 13 May 2019 17:05:14 +0900
- From: Junio C Hamano <gitster@xxxxxxxxx>
- Subject: Re: [PATCH] doc: explain why file: URLs and bundles don't mix
Alyssa Ross <hi@xxxxxxxxx> writes:
> Signed-off-by: Alyssa Ross <hi@xxxxxxxxx>
> Documentation/urls.txt | 20 +++++++++++++++-----
> 1 file changed, 15 insertions(+), 5 deletions(-)
> diff --git a/Documentation/urls.txt b/Documentation/urls.txt
> index b05da95788..c83d9f859e 100644
> --- a/Documentation/urls.txt
> +++ b/Documentation/urls.txt
> @@ -43,14 +43,24 @@ syntaxes may be used:
> - \file:///path/to/repo.git/
> -These two syntaxes are mostly equivalent, except when cloning, when
> -the former implies --local option. See linkgit:git-clone for
> +These two syntaxes are mostly equivalent, with some exceptions:
> +- When cloning, the former implies --local option. See
> + linkgit:git-clone for details.
> +- The latter is implemented using linkgit:git-upload-pack, which
> + expects its repository to be a directory, and therefore does not
> + work for bundles (see linkgit:git-bundle).
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).
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.