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

Re: Wishlist for a bundle-only transport mode

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 24, 2007, 19:15 UTC
Message-ID
<7voddjqwu0.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<8aa486160711230839o5db5fca1wc09a834ab3d4f053@mail.gmail.com>
"Santi Béjar" <sbejar@gmail.com> writes:
Show 9 quoted lines
> On Nov 23, 2007 5:05 PM, Junio C Hamano <gitster@pobox.com> wrote:
> ...
>> Maybe I am missing something from the discussion, but what
>> information loss are you referring to?
>
> Because you create an incremental bundle, so all the objects in the
> old bundle will
> not be in the new bundle. But it can be considered the natural
> behavior of bundles.

It might be natural if you are thinking within the limit of "git bundle create", but it is not natural for "git push" at all.

I think treating a bundle as if it is a bare repository with a funny representation wouldn't be so wrong, at least from the user interface point of view. IOW, I think it is natural for these:

	$ git push $remote $refspec
        $ git fetch $remote $refspec

to work as "expected" when $remote is actually a local file that is a bundle, and in fact, "git fetch" should already work that way.

What's "expected" for a push? You push from your repository the objects needed to complete LHS of given $refspec into the $remote, and then update the refs in the $remote specified by the $refspec. There is no deletion of existing objects from the $remote. That is what's expected for a push.

So if you want to implement "pushing into a bundle", the implementation would be:

  * Find the required objects in the existing bundle.  If the
    bundle file does not exist, it might be natural to treat it
    as if you are pushing into an empty but initialized regular
    repository.  If we choose to do this, for a nonexistent
    bundle file, the set of required objects is an empty set.
  * Find the recorded heads in the existing bundle.  Add or
    replace them with the RHS of $refspecs being pushed to come
    up with the new set of heads for the updated bundle.  We
    would want to perform the ordinary "fast-forward" safety and
    reject a push as needed.
  * If there are HEADs in the updated bundle that the pushing
    repository does not have, fetch them (and their required
    objects) first, as it is necessary for the next step.
  * Run this pipeline in the pushing repository to generate a
    packdata stream:
    $ git rev-list --objects <heads in the updated bundle> \
    	--not <required objects in the bundle> |
      git pack-objects --stdout
    This packdata stream will be the payload of the updated
    bundle.
  * The updated bundle will require the same set of objects as
    the bundle before the update.

This is quite different from the way how the other "transports" are implemented internally to push into usual repositories, but that is perfectly fine. What the end user sees will be consistent if you implement "push into bundle" that way and that is what matters.

	Note.  I am not saying that we _should_ allow pushing
	into a bundle to update.  I am just saying that if we
	were to implement "git push" into a bundle, that should
        behave as close as other push transports from the end
	uesr's point of view.

If you want different "object losing" semantics, "git bundle create" to create a new bundle is already there for you. You just shouldn't overload that different semantics to "git push", because that would confuse users without much gain.

Previous: Santi BéjarNext: Jakub Narebski
Message 21 of 33 in “Wishlist for a bundle-only transport mode”
  1. Santi BéjarNov 21, 2007
  2. Jakub NarebskiNov 21, 2007
  3. Santi BéjarNov 21, 2007
  4. Johannes SchindelinNov 21, 2007
  5. Jakub NarebskiNov 21, 2007
  6. Johannes SchindelinNov 21, 2007
  7. Jakub NarebskiNov 21, 2007
  8. Johannes SchindelinNov 21, 2007
  9. Jakub NarebskiNov 21, 2007
  10. Santi BéjarNov 22, 2007
  11. Junio C HamanoNov 22, 2007
  12. Jakub NarebskiNov 23, 2007
  13. Junio C HamanoNov 23, 2007
  14. Jakub NarebskiNov 23, 2007
  15. Santi BéjarNov 23, 2007
  16. Johannes SchindelinNov 23, 2007
  17. Junio C HamanoNov 23, 2007
  18. Santi BéjarNov 23, 2007
  19. Junio C HamanoNov 23, 2007
  20. Santi BéjarNov 23, 2007
  21. Junio C HamanoNov 24, 2007
  22. Jakub NarebskiNov 23, 2007
  23. Johannes SchindelinNov 21, 2007
  24. Santi BéjarNov 21, 2007
  25. Johannes SchindelinNov 21, 2007
  26. Santi BéjarNov 21, 2007
  27. bundle create: keep symbolic refs' names instead of resolving themJohannes Schindelin, Nov 21, 2007
  28. Johannes SchindelinNov 22, 2007
  29. bundle create: keep symbolic refs' names instead of resolving themJohannes Schindelin, Nov 22, 2007
  30. Kristian HøgsbergNov 21, 2007
  31. Johannes SchindelinNov 21, 2007
  32. Jakub NarebskiNov 21, 2007
  33. Johannes SchindelinNov 21, 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.