|
|
Subscribe / Log in / New account

Git’s database internals II: commit history queries (GitHub blog)

The GitHub blog has posted a detailed look at how Git stores the commit history to be able to quickly answer queries.

The commit-graph file provides a location for adding new information to our commits that do not exist in the commit object format by default. The new information that we store is called a generation number. There are multiple ways to compute a generation number, but the most important property we need to guarantee is the following:

If the generation number of a commit A is less than the generation number of a commit B, then A cannot reach B.



to post comments

Git’s database internals II: commit history queries (GitHub blog)

Posted Aug 31, 2022 8:32 UTC (Wed) by donald.buczek (subscriber, #112892) [Link]

I was just about to rant about Github displaying PR commits in author date order and thereby messing up all your beautiful work where you've spent hours rebasing until all commits nicely build on each other in a comprehensible and bisectable way.

But they seem to have changed that. [1]

Experiment with Github.com and Github Enterprise confirms it. So the pain went away two years ago and I didn't even notice. :-)

[1]: https://github.blog/changelog/2020-07-14-pull-request-com...

Git’s database internals II: commit history queries (GitHub blog)

Posted Aug 31, 2022 12:08 UTC (Wed) by bpearlmutter (subscriber, #14693) [Link] (1 responses)

There's a term for this numbering-consistent-with-partial-ordering business. And a very useful coreutil.
$ man -k 'topological sort'
tsort (1)            - perform topological sort

$ dpkg --search /usr/bin/tsort
coreutils: /usr/bin/tsort

$ man tsort | egrep -A1 DESCRIPTION | tail -1
       Write totally ordered list consistent with the partial ordering in FILE.

Git’s database internals II: commit history queries (GitHub blog)

Posted Sep 1, 2022 9:47 UTC (Thu) by tbleher (guest, #48307) [Link]

Interesting command. :)

Wikipedia has an article on tsort with some examples: https://en.wikipedia.org/wiki/Tsort (for those like me who've never used tsort).

Git’s database internals II: commit history queries (GitHub blog)

Posted Aug 31, 2022 20:44 UTC (Wed) by thmo (subscriber, #63077) [Link]

Monotone also used this technique in 2006 or so to speed up certain history functions, see: https://wiki.monotone.ca/RevisionNumbering/


Copyright © 2022, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds