Created
June 24, 2011 03:12
-
-
Save ishaaq/1044147 to your computer and use it in GitHub Desktop.
Hunt down TODO procastinators in a git repo
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/bash | |
# Finds procastinators in a git repo by looking for lines with the string TODO in it | |
# whose commit dates are from more than a month ago. | |
now=`date +%s` | |
let month_ago="$now - (30*24*60*60)" | |
echo $now $month_ago | |
for grepResult in `git grep -n TODO|cut -f 1,2 -d ':'`; do | |
file=`echo $grepResult|cut -f 1 -d ':'` | |
lineNo=`echo $grepResult|cut -f 2 -d ':'` | |
blameResult=`git blame -p -L $lineNo,$lineNo $file` | |
committer=`echo -e "$blameResult"|grep "^committer "|cut -f 2- -d ' '` | |
commitTime=`echo -e "$blameResult"|grep "^committer-time "|cut -f 2 -d ' '` | |
text=`echo -e "$blameResult"|tail -1` | |
if [ $month_ago -gt $commitTime ]; then | |
echo "<$committer> $file $lineNo $text" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment