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

Re: [PATCH 2/3] git-bundle: die if a given ref is not included in bundle

From
Junio C Hamano <junkio@cox.net>
Date
Mar 9, 2007, 23:37 UTC
Message-ID
<7v1wjy56qf.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<45F17EF0.5060008@gmail.com>
Mark Levedahl <mlevedahl@gmail.com> writes:
Show 11 quoted lines
> git>git bundle create t.bdl master --not master
> Generating pack...
> Done counting 0 objects.
> Writing 0 objects.
> Total 0 (delta 0), reused 0 (delta 0)
> git>git ls-remote t.bdl
> git>
>
> e.g, an empty bundle is created without any error or warning. This is
> the one case I believe an error should result: there is no use to
> sending (or even creating) an empty bundle.

I agree that erroring on an empty output is a sensible _option_ just like pack-objects has --no-empty option.

The above is actually an interesting example in a different sense. When somebody did the following, what should be output?

	$ edit; git commit -a ;# on master
        $ git checkout -b side
        $ edit; git commit -a ;# on side
        $ git bundle create foo.bdl master side ^master
	$ git bundle verify foo.bdl

My answer is that it should list master and side as the available heads and master itself as also a prerequisite (which is not what the current code does).

I think unbundling foo.bdl should be the moral equivalent of fetching from the originating repository by somebody who has its prerequisites as tips of some branches. So I think foo.bdl should list refs/heads/master as one of the available heads to fetch/pull from, while requiring the same commit as prerequisite of the bundle. It is as if you tried "git fetch" and found out that you are up to date. Listing where the 'master' tip is, even though you did not have to include any commits from that branch, gives you a useful bit of information ("I am up to date with respect to that branch").

So I think if you did this instead in the above sequence: 
	$ git bundle create foo.bdl master ^master

it would be sensible to have an option to error out because of empty pack, but at the same time it would equally be sensible to have an option to still create a bundle with an empty pack contents. In either case, the head and prerequisite section should include the tip of the master. Earlier, I said we should error out if we do not find 'master' in the list of shown objects, but I think it is more sensible to add it to both the list of head _and_ prerequisites.

Previous: Mark LevedahlNext: Mark Levedahl
Message 8 of 21 in “git-bundle: die if a given ref is not included in bundle”
  1. 2/3 git-bundle: die if a given ref is not included in bundleJohannes Schindelin, Mar 9, 2007
  2. Mark LevedahlMar 9, 2007
  3. Junio C HamanoMar 9, 2007
  4. Mark LevedahlMar 9, 2007
  5. Mark LevedahlMar 9, 2007
  6. git-bundle: only die if pack would be empty, warn if ref is skippedJohannes Schindelin, Mar 9, 2007
  7. Mark LevedahlMar 10, 2007
  8. Junio C HamanoMar 9, 2007
  9. Mark LevedahlMar 10, 2007
  10. Johannes SchindelinMar 10, 2007
  11. Mark LevedahlMar 10, 2007
  12. Johannes SchindelinMar 10, 2007
  13. Mark LevedahlMar 10, 2007
  14. Johannes SchindelinMar 11, 2007
  15. Junio C HamanoMar 11, 2007
  16. Johannes SchindelinMar 11, 2007
  17. Mark LevedahlMar 11, 2007
  18. Junio C HamanoMar 11, 2007
  19. Johannes SchindelinMar 11, 2007
  20. Mark LevedahlMar 13, 2007
  21. git-bundle: die if the bundle is empty.Mark Levedahl, Mar 9, 2007

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.