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

Re: Are binary xdeltas only used if you use git-gc?

From
Nicolas Pitre <nico@cam.org>
Date
Nov 3, 2008, 21:42 UTC
Message-ID
<alpine.LFD.2.00.0811031611060.13034@xanadu.home>
In-Reply-To
<f1d2d9ca0811031235w3581f7ffnc7380b4cb488e71a@mail.gmail.com>
On Mon, 3 Nov 2008, Thanassis Tsiodras wrote:
Show 20 quoted lines
> Despair...
> 
> I just tested "git push --thin"...
> Doesn't work.
> 
> It still sends the complete object, not a tiny pack as it could (should).
> 
> But perhaps I now understand why:
> 
> I run git-gc on both the remote end and the working end (before
> changing anything,
> i.e. with both repos being in sync - "git pull" and "git push" report all OK).
> I then noticed that on the remote side, .git/objects/pack had one big pack file,
> but on the local one I have two .pack files...!
> 
> I proceeded to try (many combinations of params on) git-repack in a vain attempt
> to make my local repos also have one single .pack file (presumably, it
> should be able
> to exactly mirror the remote one, since it has the same objects inside
> it!). No way...

Please stop thinking that your repository layout has anything to do with what is actually transferred on a push. It has not.

Here's a small test that you can do locally:
	mkdir repo_a
	mkdir repo_b
	cd repo_a
	git init
	seq 1000000 > data
	git add data
	git commit -m "initial commit"
	cd ../repo_b
	git init
	cd ../repo_a
	git push ../repo_b master:master
Here you should see a line that says:
	Writing objects: 100% (3/3), 2.01 MiB, done.
Therefore 2.1 MiB were transferred.  Now let's continue:
	echo "foo" >> data
	git add data
	git commit -m "second commit"
	git push ../repo_b master:master
You should get:
	Writing objects: 100% (3/3), 423 bytes, done.

And this means that you even don't need the --thin switch (which is wrong -- this has been broken before but that's another story) for the transfer to actually send only the difference and not the whole file again. And note that none of those repositoryes actually contain any pack as everything is still loose objects.

> I'm at a loss as to why the two repos are having different "pack 
> representation" of the same objects

That's only because those objects entered each repositories in a different way.

> and why git-gc and git-repack fail 
> to create a single pack on my working side,

Maybe you have a .keep file in .git/objects/pack/ ? If so delete it and run 'git repack -a -d'.

> but I'm guessing that this is why "git push --thin" fails to send 
> small xdeltas...
Not at all.

Please provide a complete log of your tests and maybe we could find something.

Nicolas
Previous: Pieter de BieNext: Thanassis Tsiodras
Message 15 of 23 in “Are binary xdeltas only used if you use git-gc?”
  1. Thanassis TsiodrasOct 31, 2008
  2. Pierre HabouzitOct 31, 2008
  3. Thanassis TsiodrasOct 31, 2008
  4. Nicolas PitreOct 31, 2008
  5. Nicolas PitreOct 31, 2008
  6. Jakub NarebskiOct 31, 2008
  7. Thanassis TsiodrasOct 31, 2008
  8. Jakub NarebskiOct 31, 2008
  9. Matthieu MoyOct 31, 2008
  10. Nicolas PitreOct 31, 2008
  11. Thanassis TsiodrasNov 1, 2008
  12. Nicolas PitreNov 1, 2008
  13. Thanassis TsiodrasNov 3, 2008
  14. Pieter de BieNov 3, 2008
  15. Nicolas PitreNov 3, 2008
  16. Thanassis TsiodrasNov 3, 2008
  17. Nicolas PitreNov 4, 2008
  18. Junio C HamanoNov 4, 2008
  19. Nicolas PitreNov 4, 2008
  20. Junio C HamanoNov 4, 2008
  21. Jean-Luc HerrenOct 31, 2008
  22. Matthieu MoyOct 31, 2008
  23. Thanassis TsiodrasOct 31, 2008

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.