Skip to content

Instantly share code, notes, and snippets.

@ishaaq
Created June 24, 2011 03:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ishaaq/1044147 to your computer and use it in GitHub Desktop.
Save ishaaq/1044147 to your computer and use it in GitHub Desktop.
Hunt down TODO procastinators in a git repo
#!/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