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

Re: CAREFUL! No more delta object support!

From
Linus Torvalds <torvalds@osdl.org>
Date
Jun 29, 2005, 18:59 UTC
Message-ID
<Pine.LNX.4.58.0506291142510.14331@ppc970.osdl.org>
In-Reply-To
<Pine.LNX.4.58.0506271910390.19755@ppc970.osdl.org>
On Mon, 27 Jun 2005, Linus Torvalds wrote:
Show 10 quoted lines
> 
> On Mon, 27 Jun 2005, Junio C Hamano wrote:
> > 
> > Shouldn't feeding "git-rev-list --object" output plus
> > handcrafted list of objects in 2.6.11 tree object to
> > git-pack-objects just work???
> 
> You could do that. And yes, we can add support for "tag" objects too 
> (which the packing doesn't do at all right now. So this is not a 
> "fundamental" problem, it's just a practical one right now.

Ok, I've added the logic to "git-rev-list --object" to handle arbitrary object dependencies.

So you can do things like this, if you want to:
	git-rev-list --object HEAD ^v2.6.11-tree

which basically generates the complete list of every object reachable from HEAD, but not reachable from the v2.6.11 tree. It also understands about tags, so if you do

	git-rev-list --object v2.6.12 ^v2.6.11-tree

the end result will have the "v2.6.12" tag in it (along with all the objects reachable from it, but not reachable from v2.6.11-tree).

What does this mean? It means that you can do a "push" from repository "a" to repository "b" by doing

 - in "b", do
	refs_in_b=($(find .git/refs -type f | xargs cat))
 - in "a" do
	refs_in_a=($(find .git/refs -type f | xargs cat))
 - then, in "a", do
	git-rev-list "${refs_in_a[@]}" --not "${refs_in_b[@]}" |
		git-pack-objects --stdout > push.pack
   to generate the objects pack in "push.pack"
 - then, in "b", do
	git-unpack-objects < push.pack

and you now have moved over _all_ the objects that were referenced in "a", but not in "b". Including tags etc. So after that last stage, when you've unpacked the objects, the only thing left to do is to make the refs in "b" point to the new references from "a" (which basically boils down to a "cp", except it would be good to verify that the refs in "b" still have the same values as they did before we did the object push).

Daniel (or anybody else), interested? Please?

Of course, you can do this one branch at a time, too, if you want to, but the above was meant as an example of how you can actually do all the branches in one single pack-file, which is a lot more efficient (if you do it one branch at a time, you'll quite possible end up transferring objects that are reachable in other branches multiple times, while the "all in one go" thing will pack each object just once).

Now, have I actually _tested_ the above? Hell no. But all the heavy lifting should now be done for doing an efficient "git push" that pushes all branches in one go (or one at a time, it's your choice on how you end up using git-rev-list).

		Linus
Previous: Linus TorvaldsNext: Daniel Barkalow
Message 32 of 38 in “CAREFUL! No more delta object support!”
  1. Linus TorvaldsJun 28, 2005
  2. Christopher LiJun 27, 2005
  3. Linus TorvaldsJun 28, 2005
  4. Junio C HamanoJun 28, 2005
  5. Christopher LiJun 28, 2005
  6. Petr BaudisJun 28, 2005
  7. Benjamin LaHaiseJun 28, 2005
  8. Petr BaudisJun 28, 2005
  9. Jan HarkesJun 28, 2005
  10. Christopher LiJun 28, 2005
  11. Linus TorvaldsJun 28, 2005
  12. Emit base objects of a delta chain when the delta is output.Junio C Hamano, Jun 29, 2005
  13. Junio C HamanoJun 28, 2005
  14. Skip writing out sha1 files for objects in packed git.Junio C Hamano, Jun 28, 2005
  15. Linus TorvaldsJun 28, 2005
  16. Junio C HamanoJun 28, 2005
  17. Linus TorvaldsJun 28, 2005
  18. Linus TorvaldsJun 28, 2005
  19. Junio C HamanoJun 28, 2005
  20. Adjust to git-init-db creating $GIT_OBJECT_DIRECTORY/packJunio C Hamano, Jun 28, 2005
  21. Linus TorvaldsJun 28, 2005
  22. Daniel BarkalowJun 28, 2005
  23. Linus TorvaldsJun 28, 2005
  24. Linus TorvaldsJun 28, 2005
  25. Daniel BarkalowJun 28, 2005
  26. Linus TorvaldsJun 28, 2005
  27. Linus TorvaldsJun 28, 2005
  28. Matthias UrlichsJun 28, 2005
  29. Matthias UrlichsJun 28, 2005
  30. Daniel BarkalowJun 28, 2005
  31. Linus TorvaldsJun 29, 2005
  32. Linus TorvaldsJun 29, 2005
  33. Daniel BarkalowJun 29, 2005
  34. Linus TorvaldsJun 29, 2005
  35. Daniel BarkalowJun 29, 2005
  36. Adjust fsck-cache to packed GIT and alternate object pool.Junio C Hamano, Jun 28, 2005
  37. Expose packed_git and alt_odb.Junio C Hamano, Jun 28, 2005
  38. 3/3 Update fsck-cache (take 2)Junio C Hamano, Jun 28, 2005

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.