This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# git-create-review | |
# Generates a diff based on a grep in the comments of the commits | |
REV_NUMS=`git log --grep=$1 --oneline -i --reverse | awk '{print $1;}'` | |
for revhash in $REV_NUMS; do | |
PREV_SVN_REV=`git svn find-rev $revhash^` | |
SVN_REV=`git svn find-rev $revhash` | |
git diff --no-prefix $revhash^..$revhash | | |
sed -e "/^diff --git [^[:space:]]*/{h;}" \ | |
-e "s/^diff --git [^[:space:]]*/Index:/" \ | |
-e "s/^index.*/===================================================================/" \ | |
-e "/^new file .*/d" \ | |
-e "/^--- \/dev\/null/{g;}" \ | |
-e "s/^diff --git [^[:space:]]*/-+-/" \ | |
-e "s/^+++ .*/&\t(revision $SVN_REV)/" -e "s/^--- .*/&\t(revision $PREV_SVN_REV)/" -e "s/^-+- .*/&\t(revision 0)/" \ | |
-e "s/^-+- [[:space:]]*/--- /" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment