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

Respun - Scripts to use bundles to move data between repos

From
Mark Levedahl <mdl123@verizon.net>
Date
Feb 16, 2007, 00:19 UTC
Message-ID
<11715851974102-git-send-email-mdl123@verizon.net>
Respun patch for git-bundle / git-unbundle.

I am working a project using git where we have many repositories on machines that can never be directly connected, but which need to have the same objects and development history. Existing git protocols offer limited support: we can either a) publish and apply patch files branch by branch, or b) copy an entire repository from one machine to another and then do local push or fetch. While both are workable, neither is a completely satisfactory solution, so I wrote the attached scripts that support a "bundle" transfer mechanism. A bundle is a tar archive having two files: a list of references as given by git-show-ref and a pack file of objects from git-pack-objects. git-bundle creates the bundle, git-unbundle unpacks and applies at the receiving end. The means of transporting the bundle file between the machines is arbitrary (sneaker net, email, etc all can work).

This transfer protocol leaves it to the user to assure that the objects in the bundle are sufficient: git-fetch and git-push determine what is needed by comparison, but no such conversation is possible here. The approach is to specificy a range of commits to include in the bundle: e.g. git-bundle master~10..master to get the last 10 commits. Having too many is fine: git at the receiving end happily ignores duplicates. Having too few objects raises an error and references are updated only if their full set of dependencies are found in the target repository.

---

Thanks to all for comments on my previous set of patches on this topic, I have respun them, taking the following actions on the various suggestions.

1) Reformat help and .txt to fit 80 column screen: Done.
2) Use tar for the bundle, not zip. Done.
3) Link into main makefile: Done (including rename of git* to git*.sh
4) Link into Documentation/cmd-list.perl: Done.
5) Source git-sh-setup: Done (including removal of --bare and git dir
   checks).
6) Use git-index-pack rather than git-unpack-objects -Done.
7) Pipe ref list directly into git-pack-objects. - doesn't handle
   rev-list-args such as --since=5.days.ago, piping through git-rev-list
   first does so I left it that way.
8) Shallow option was broken - removed as non-essential and too hard to
   fix. (can re-add properly later if someone really wants it).
9) Dont use git-fsck, instead tell receiver what commits are needed
   directly. Done, but with regrets. git-rev-list --objects-edge needs
   to be taught to work when given --max-age, git-bundle calculates the
   required result using a shell pipeline for the moment. Will revisit
   after re-educating git-rev-list. (git-bundle does use git-rev-list
   when --max-age is not present).
10) Allow --output file, rather than --output=file. Rejected as this
   required git-bundle to check arguments for git-rev-list rather than
   letting git-rev-parse do that, or requires a specific ordering of
   inputs. The first violates separation of functions (let git-rev-parse
   handle errors on arguments it takes), or simply trades one annoyance
   for another. No available solution is better than what is there now.
11) Don't use temporary files in git-bundle. Left as is. Shell scrambles
   binary data, so cannot be used to split out a binary pack file. This
   is the service tar provides, and tar will only build from existing
   files, so temporary files are needed unless this whole thing is
   re-written in C.
Mark Levedahl
Next: Mark Levedahl
Message 1 of 22 in “Respun - Scripts to use bundles to move data between repos”
  1. Mark LevedahlFeb 16, 2007
  2. Add git-bundle - pack objects and references for disconnected transferMark Levedahl, Feb 16, 2007
  3. Add git-unbundle - unpack objects and references for disconnected transferMark Levedahl, Feb 16, 2007
  4. Include git-bundle and git-unbundle in Makefile.Mark Levedahl, Feb 16, 2007
  5. Create documentation for git-bundle.Mark Levedahl, Feb 16, 2007
  6. Create documentation for git-unbundle.Mark Levedahl, Feb 16, 2007
  7. Link git-bundle and git-unbundle docs from git(7).Mark Levedahl, Feb 16, 2007
  8. Junio C HamanoFeb 16, 2007
  9. Linus TorvaldsFeb 16, 2007
  10. Add git-unbundle - unpack objects and references for disconnected transferMark Levedahl, Feb 16, 2007
  11. Shawn O. PearceFeb 16, 2007
  12. Junio C HamanoFeb 16, 2007
  13. Shawn O. PearceFeb 16, 2007
  14. Mark LevedahlFeb 16, 2007
  15. Junio C HamanoFeb 16, 2007
  16. Junio C HamanoFeb 16, 2007
  17. Shawn O. PearceFeb 16, 2007
  18. Junio C HamanoFeb 16, 2007
  19. Add git-bundle - pack objects and references for disconnected transferMark Levedahl, Feb 16, 2007
  20. Shawn O. PearceFeb 16, 2007
  21. Simon 'corecode' SchubertFeb 16, 2007
  22. Shawn O. PearceFeb 16, 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.