From: Junio C Hamano <gitster@pobox.com>
To: Andrew Harmon <aharmon@signalquest.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [BUG] git clone from bundle with --all does not fetch all refs
Date: Wed, 08 Oct 2025 10:23:44 -0700 [thread overview]
Message-ID: <xmqqo6qhfgtb.fsf@gitster.g> (raw)
In-Reply-To: <BL3PR13MB520981A726145113DCA8B910BBE0A@BL3PR13MB5209.namprd13.prod.outlook.com> (Andrew Harmon's message of "Tue, 7 Oct 2025 23:11:16 +0000")
Andrew Harmon <aharmon@signalquest.com> writes:
> The experience of "cloning from bundle should be just like cloning
> from github" did not happen for me. Maybe I created the bundle
> wrong?
I did not say "github", though ;-)
> See the workflow, below. Is the problem that refs are put in the
> bundle at refs/remotes/origin/* instead of refs/heads/*?
Everything looks as expected, including how you prepared a bundle
file. Perhaps your expectation of what a bundle file is for is
different from what bundle files are designed for? By that, I mean
that you may have a use case the designers of "git bundle" feature
never anticipated.
The primary and only use case "git bundle" was designed to cater to
was this. The user has a repository on this machine that they want
to be cloned to another machine, but for whatever reason, it cannot
be done over the network by typing "git clone ..." on that other
machine against this machine. So the user makes a bundle out of the
repository on this machine, copy that file on a USB stick, bring it
over there, and then the user says "git clone ..." against the
bundle file as if they are cloning from the original.
For that to work, refs/heads/master in the original repository is
stored as refs/heads/master in the bundle. The remote-tracking
branches may by default not copied into the bundle, but you can by
instructing "git bundle" command.
And if you want to copy the remote-tracking branches via "git clone"
or "git fetch" over the network, you'd specifically ask for them,
as "clone" would by default prepare fetch refspecs for their local
branches to be copied to your remote-tracking branches, and their
refs/tags/ copied to your refs/tags/. and nothing else. As a bundle
file wants to imitate end-user experience of cloning or fetching
over the network from the original repository for sneaker-net
operation, the need for specifically asking is the same if you want
to grab (their) remote-tracking branches out of a bundle file.
Stepping back a bit, how would you make a more-or-less exact copy
of an existing repository over the network? "git clone --mirror"
is probably the mechanism where their refs/heads/master becomes the
refs/heads/master in the resulting repository and the remote-tracking
branches they have in their refs/remotes/origin/* would become the
remote-tracking branches refs/remotes/origin/* in the resulting
repository. So perhaps doing that against the bundle file would do
what you wanted to do? If that is the case, then perhaps your use
case was covered by the original design of the "git bundle" feature
after all---to allow you to clone or fetch from the file as if you
are cloning or fetching from the original repository.
HTH.
next prev parent reply other threads:[~2025-10-08 17:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-07 21:11 [BUG] git clone from bundle with --all does not fetch all refs Andrew Harmon
2025-10-07 22:15 ` Junio C Hamano
2025-10-07 23:11 ` Andrew Harmon
2025-10-08 17:23 ` Junio C Hamano [this message]
2025-10-08 18:17 ` Andrew Harmon
2025-10-08 18:51 ` Andreas Schwab
2025-10-08 19:19 ` Andrew Harmon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqo6qhfgtb.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=aharmon@signalquest.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.