Add a script to determine the commit order implied by their changes
commit978d6a8e14cedfba101f1f3c2476966e3704adab
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Mon, 23 Dec 2013 16:02:12 +0000 (23 10:02 -0600)
committerJohannes Schindelin <johannes.schindelin@gmx.de>
Sat, 28 Dec 2013 00:02:04 +0000 (27 18:02 -0600)
tree10a5c83f15c4c28a79e4e350859921742748f30c
parent9219c6752fa3a2ae02471075a549f84e3917374f
Add a script to determine the commit order implied by their changes

The idea comes from darcs: a (non-merge) commit can be easily exchanged
with its parent commit if -- and only if -- their respective diffs touch
different parts of the files they modify.

With merge commits thrown into the fray, it gets slightly more unwieldy,
and what we are really interested in is not so much to actually exchange
the commits, but to know their relationship.

Therefore, this tool only determines the commit topology implied by
their respective changes, and then shows the topology via gitk or `git
log --graph`.

Note that we let renaming commits be implied parents of subsequent
changes. This is somewhat unintuitive because commits can be
cherry-picked sometimes when the modified files in question have been
renamed. However, this is not really reliable due to the rename
detection failing when too many changes happened in the meantime, so
we'll err on the safe side.

Also, while it would have been nice to use `git log -p -m` to read the
original commit history at the same time as the diffs -- without having
to launch new processes, so as to avoid challenging Windows and other
operating systems whose filesystem and process management technology
fell a little behind -- but we need to use custom commit message
formatting to obtain both short and long commit names at the same time
(to accomodate command-line length limitations imposed by Windows), and
there is simply no support in Git to retrieve the *current* parent in
custom commit messages when using '-m' (showing diffs relative to *all*
parents in case of merge commits).

In contrast to darcs, we do not use Haskell (which would essentially
lock out the 99% of programmers who do not speak that language) and we
do not try to explain the concept by employing oh-so-intuitive quantum
physics theory.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
share/msysGit/implied-commit-order.perl [new file with mode: 0755]