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

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

From
TTThanassis Tsiodras <ttsiodras@gmail.com>
Date
Oct 31, 2008, 09:43 UTC
Message-ID
<f1d2d9ca0810310243r669840bbj2c5ee7183e0caaed@mail.gmail.com>
Hi everyone.

I've been usig Git for the last couple of months and am quite happy with it. In one of my Git repositories, I am storing uncompressed .tar files (since being uncompressed allows git to detect and store only their "real"differences).

However, when I introduce a new filename in the repos (with a minor set of differences compared to an existing file with a different filename) I've been unsuccessful in finding a way to tell Git to do it efficiently...

This is what I mean:

bash$ mkdir -p /var/tmp/tst bash$ cd /var/tmp/tst bash$ git init bash$ cp /var/www/renderer-2.0e.tar . bash$ git add renderer-2.0e.tar bash$ git commit -m "First version" bash$ du -s -k .git/ 1724 .git/ bash$ cp renderer-2.0e.tar renderer-2.0f.tar bash$ git add renderer-2.0f.tar bash$ git commit -m "To add new version, first copy the first, so Git detects it" bash$ du -s -k .git/ 1740 .git/ bash$ echo Good, Git detected it is the same bash$ cp /var/www/renderer-2.0f.tar . bash$ git add renderer-2.0f.tar bash$ git commit -m "Real new version, slightly different to first" bash$ du -s -k .git/ 3344 .git/ bash$ echo What... did I do something wrong bash$ xdelta delta renderer-2.0e.tar renderer-2.0f.tar delta bash$ ls -l total 7788 -rw-r--r-- 1 ttsiod ttsiod 8181 2008-10-31 11:27 delta -rw-r--r-- 1 ttsiod ttsiod 3962880 2008-10-31 11:23 renderer-2.0e.tar -rw-r--r-- 1 ttsiod ttsiod 3993600 2008-10-31 11:25 renderer-2.0f.tar bash$ git-gc bash$ du -s -k .git/ 1660 .git/

So even though the xdelta is just 8KB, and git-gc actually finds out that indeed the new file is very similar to the old one, the initial commit of the new version in the repos is not taking advantage.

I found out about this when I tried to "git push" over a PSTN modem...

Then again, I must confess I only did the git-gc after I pushed. Does the git-push actually take advantage of the similarities only if I do a git-gc first?

If that is the case, I will create an alias to always git-gc after commits...

-- What I gave, I have; what I spent, I had; what I kept, I lost. -Old Epitaph

Next: Pierre Habouzit
Message 1 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.