Last active
December 1, 2016 11:20
-
-
Save jsrois/234df9b465758b5e24aeaf9ef477f486 to your computer and use it in GitHub Desktop.
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 | |
if [ "$#" -ge 1 ]; then | |
first_commit=$1 | |
else | |
first_commit=HEAD^ | |
echo "Analyzing last commit only" | |
fi | |
for commit in $(git log $first_commit..HEAD --pretty=format:"%h") ; do | |
echo "Analyzing commit $commit ..." | |
for file in $(git diff-tree --no-commit-id --name-only -r $commit) ; do | |
commented_out_lines=$(git show $commit --no-ext-diff --unified=0 --exit-code -a --no-prefix -- $file | egrep "^\+//") | |
commented_out_lines_count=$(echo "$commented_out_lines" | wc -l | awk '{print $1}') | |
if [ "$commented_out_lines_count" -gt 1 ]; then | |
echo "Found the following $commented_out_lines_count commented-out lines in file $file:" | |
echo "$commented_out_lines" | |
fi | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment