1st pass at git-annotate (not-quite functional, however)
RFC 1/1 1st pass at git-annotate (not-quite functional, however)
Here's my stab at getting git-annotate working. This requires the --remove-empty addition to git-rev-list Linus sent out a few days ago.
This code is not complete, but on my test case (git-format-mbox.sh) it does track through renames, and does figure out authorship of about half the lines (rough guess).
I have learned that parsing an arbritrary length series of diffs is hard, mostly because trying to infer line numbers from them is tricky (especially when you contemplate tracking state down multiple merges at once.)
I currently have a very naive approach of tracking offsets in here, built as the diff is parsed. I know it's wrong, but it's not too wrong, if you ignore merges.
I haven't figured out exactly how I want to handle annotating across merges, but I think the general idea I have here will work, it just needs to be ripped out of global variables and stuck into some structures that get passed around/split/merged up/etc.
I'm posting this tonight because I won't have time to look at this again for a few days (probably the weekend), and someone else might see a way to make this work a bit easier.
Without further ado, git-annotate:
Makefile | 2 git-annotate.perl | 309 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 310 insertions(+), 1 deletions(-) create mode 100755 git-annotate.perl
df7b8b7bf682411485aefa31c6dc24a4b8adf316
Makefile +1 -1
@@ -118,7 +118,7 @@ SCRIPT_PERL = \ git-archimport.perl git-cvsimport.perl git-relink.perl \ git-shortlog.perl git-fmt-merge-msg.perl \ git-svnimport.perl git-mv.perl git-cvsexportcommit.perl \ - git-graft-ripple.perl + git-graft-ripple.perl git-annotate.perl SCRIPT_PYTHON = \ git-merge-recursive.py
git-annotate.perl new file +309 -0
309 lines not on this page · raw message
Signature · 7 lines
1.1.4.g31e9b -- Ryan Anderson sometimes Pug Majere
Quoted 2 lines · Ryan Anderson
I haven't figured out exactly how I want to handle annotating across merges,...
You might want to take a look at the "passing blames around" algorithm I did for "git blame" loooooooooooooooong time ago.
http://article.gmane.org/gmane.comp.version-control.git/5483