Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Does anyone know if the structure of git has changed much? I would like to read this thinking this is pretty close to the current implementation but I would have no idea. anyone?


It seems to be mostly the same, except that "Changeset" is now called "Commit" and "Current directory cache" is now called "index", but they are functionally the same.

It's actually really great to see that the model hasn't changed much (there must have been a long phase of thinking before though)

If you want to go deeper, you can check out this page:

http://www.git-scm.com/book/en/v2/Git-Internals-Git-Objects


You can just see the structure with git cat-file

    -> % git cat-file -p 8c48d1a36c3d11db44c75a431d4f09cb0035222f
    tree 288c2d5379768f685f391bdbffd31b8965318c63
    parent 002ae35061beef02453b7fb1045a50fa2f7f30f8
    author Denis Bilenko <[email protected]> 1246939605 +0700
    committer Denis Bilenko <[email protected]> 1246939605 +0700

    MANIFEST.in: include libevent.h and libevent-internal.h
    -> % git cat-file -p 288c2d5379768f685f391bdbffd31b8965318c63
    100644 blob 6e543dc13df1b556fd95530061ac0c77a9178309.hgignore
    100644 blob 79c7beb2227ce149c7a71e58e2f7379071b7a189MANIFEST.in
    100644 blob 0d05178544942a035a82599900bec27fbac1c9c5README.eventlet
    040000 tree edb8f37fa622315dcf7bf4f7316d5e85c48cfdbdexamples
    040000 tree 64cf252d77a4162099442bb0153985fc20ed5ba3gevent
    040000 tree 261052e04b4aece469b2e767e394aafbc9d88a32greentest
    100644 blob 488e805c563dfeeb6af5e7a1a8953b706d9676e3setup.py
    -> % git cat-file -p 6e543dc13df1b556fd95530061ac0c77a9178309
    syntax: glob
    *~
    *.pyc
    *.orig
    dist
    gevent.egg-info
    build
    htmlreports
    results.*.db
    gevent/core.so
And yeah it's still very similar though it currently doesn't store the objects individually but rather packs them together.


I wrote about the format of git trees (and other object types) here:

http://alblue.bandlem.com/2011/08/git-tip-of-week-trees.html


While it looks arcane, this comes in handy enough when grepping through history that I actually have "cat-file -p" aliased to 'cf'.


One noteworthy difference is that in the original repository format, a tree object was just a list of named blobs. Nowadays each subdirectory of a tree is its own nested tree object, which means that when you're comparing two trees, you can skip over the directories that are identical.

I'm not sure when that change was made but it must have been very early on, because the repository format has been basically stable for many years now.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: