Sort commits topologically first instead of by author date #386
Description
Like git log --topo-order
does by default. E.g.: https://github.com/cirosantilli/test-log-order/commits/master , screenshot 2015-05-01.
Generated with:
git init
touch '0'
git add '0'
date='2011-01-01 00:01:01 +0000'
GIT_COMMITTER_DATE="$date" git commit -m '0' --date "$date"
touch '1'
git add '1'
date='2010-01-01 00:01:01 +0000'
GIT_COMMITTER_DATE="$date" git commit -m '1' --date "$date"
Tree:
0 --> 1
Actual log:
Commit | Date |
---|---|
0 | 2011 |
1 | 2010 |
Expected log:
Commit | Date |
---|---|
1 | 2010 |
0 | 2011 |
The actual tree structure is more important than the timestamp, which is just an arbitrary value that can be controlled by users.
For example, if an old commit gets merged later, I'd expect to see it on the top of the log as the merge date is what matters most.
Not to mention my evil desire to annoy projects by making a future max commit cirosantilli/test-git-web-interface@ff86a7b, create a fake account, find a typo on some famous project with aspell
and make a pull request. I bet it would pass, and when the project admins notice it, they would likely be forced to force push it away. MUAHAHAHA. But I won't do it :-)
Maybe this was mentioned at: https://help.github.com/articles/why-are-my-commits-in-the-wrong-order/
IMHO the best option is --topo-order
from man git-log
, as it shows the most "logical" topo sort possible. libgit2 even has it already: https://libgit2.github.com/libgit2/ex/HEAD/log.html#section-23