On Sat, 12 Jan 2013 14:47:03 +0400 Konstantin Khomoutov <flatw...@users.sourceforge.net> wrote:
[...] > You could roll your own history walking using calls to the > `git cat-file` plumbing command [...] > You could first try a no-brainer approach though: start from the > specified revision (say, HEAD), capture what's available in the tree > associated with it and then go down the history looking for a moment > where the *name* of an object as recorded in the tree of the starting > revision changes its SHA-1 [...] As to implementation: 1) Call `git cat-file commit <rev>` for the starting revision, parse out committer, author, date, SHA-1 hashes of the parent commits and the tree associated with this revision. 2) Call `git cat-file tree <tree_sha1_hash>` on the tree's hash obtained on the previous step. Parse the contents of the returned tree object, remember the names, types and SHA-1 hashes of all the objects listed in it. 3) Take the first parent commit obtained on step (1), and perform steps (1) and (2) for it. After the step (2), compare the trees, object by object: an object might be either missing in this parent tree which means it was added in the tree you started with, or change its SHA-1 hash which means it has been changed in the tree you started with. Note that lines of history ending in a merge commit might converge to a single commit down the history which is typical for a feature branches. The `git merge-base` command is there to find such base commits. --