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

Re: Curious about details of optimization of object database...

From
Boyd Stephen Smith Jr. <bss@iguanasuicide.net>
Date
Jan 9, 2009, 19:07 UTC
Message-ID
<200901091307.33483.bss@iguanasuicide.net>
In-Reply-To
<20090109174623.GC12552@seberino.org>
On Friday 2009 January 09 11:46:23 chris@seberino.org wrote:
>I'm told a commit is *not* a patch (diff), but, rather a copy of the entire
>tree.

It's even more than that. A commit object contains its message, the SHA of the tree, and zero or more SHAs for its parents.

>Can anyone say, in a few sentences, how git avoids needing to keep multiple
>slightly different copies of entire files without just storing lots of
>patches/diffs?

Loose objects can have large swaths of duplicated data. However, git also supports storing objects in a packed format, which uses delta compression to reduce the duplication to close to nothing.

Some examples: Sizes are from "du -sh .git ."; The .git directory stores all the objects as well as the repository configuration, refs, reflogs, etc. The . directory has .git and a clean checkout of master.

The LinuxPMI (http://linuxpmi.org/) tree: 41M .git 83M . (So, the storage is actually a bit smaller than the checkout; 984 objects; 140 commits)

A small project between me an my flatmates: 309K .git 3.6M . (Here, the storage is significantly smaller than the checkout; 786 objects; 155 commits)

My repository that tracks my dotfiles: 124K .git 176K . (113 objects; 28 commits)

-- 
Boyd Stephen Smith Jr.                     ,= ,-_-. =. 
bss@iguanasuicide.net                     ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' 
http://iguanasuicide.net/                      \_/     
Previous: David Brown
Message 5 of 5 in “Curious about details of optimization of object database...”
  1. chris@seberino.orgJan 9, 2009
  2. Matthieu MoyJan 9, 2009
  3. Nicolas PitreJan 9, 2009
  4. David BrownJan 9, 2009
  5. Boyd Stephen Smith Jr.Jan 9, 2009

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.