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

Re: [BUG] Git clone of a bundle fails, but works (somewhat) when run with strace

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 25, 2013, 06:59 UTC
Message-ID
<7vy5eczxoj.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20C7ED1EA37C4EECA28070D1483C57B7@PhilipOakley>
"Philip Oakley" <philipoakley@iee.org> writes:
Show 18 quoted lines
>>> You probably wanted "git bundle create ../repo.bundle --all" which
>>> includes both "master" and "HEAD".
>>
>> That explains it, thanks! Maybe this could be added as an example to
>> the
>> documentation for `git bundle`? People looking at `man git-bundle`
>> hoping
>> to use it as one possible way to make a backup of a Git repository
>> might
>> not realize right away that --all is the way to specify all refs, like
>> with `git log`.
>
> I had posted a documentation patch back in Setemeber last year,
> http://thread.gmane.org/gmane.comp.version-control.git/205887/focus=205897,
> however Junio highlighted some additional concerns that I wasn't able
> to respond to at the time.
>
> It may be worth resurrecting once the concerns have been addressed.

A saner thing to do, instead of explaining away the lack of HEAD as "the creator of the bundle did not bother to name it", might be to automatically add an artificial HEAD to the resulting bundle when the arguments given to specify the "range" do not have any negative ones (because by definition such a bundle is unsuitable for use with "git clone" [*1*]), and HEAD is not among the refs.

The heuristics to pick what to record as the artificial HEAD could vary, though. Without thinking things through...

 * When only one positive ref is given, use it (sort of obvious);
 * When two or more positive refs are given, and the current branch
   is one of them, use that;
 * Otherwise, pick the "first" positive ref given from the command
   line.
perhaps?
[Footnote]

*1* Strictly speaking, this condition could be loosened, as long as cloning side uses an appropriate --depth, but I do not know such an "advanced use case" needs a hand-holding change to add a HEAD that was not asked by the user.

Previous: Philip OakleyNext: Bram Geron
Message 8 of 9 in “[BUG] Git clone of a bundle fails, but works (somewhat) when run with strace”
  1. Alain KalkerFeb 15, 2013
  2. Alain KalkerFeb 15, 2013
  3. Alain KalkerFeb 16, 2013
  4. Junio C HamanoFeb 16, 2013
  5. Jeff KingFeb 16, 2013
  6. Alain KalkerFeb 17, 2013
  7. Philip OakleyFeb 17, 2013
  8. Junio C HamanoFeb 25, 2013
  9. Bram GeronMay 28, 2014

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.