Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some fatal for git-line-summary #368

Merged
merged 1 commit into from
May 9, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions bin/git-line-summary
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
project=${PWD##*/}

#
# list the last modified author for each line
# list the last modified author for each line
#
function single_file {
while read data
do
if [[ $(file $data) = *text* ]]; then #
git blame --line-porcelain $data | sed -n 's/^author //p';
if [[ $(file $data) = *text* ]]; then #
git blame --line-porcelain $data 2>/dev/null | grep "author\ " | sed -n 's/^author //p';
fi
done
}
Expand Down Expand Up @@ -42,19 +42,19 @@ function result {
authors | awk '
{ args[NR] = $0; sum += $0 }
END {
printf " %-9s: %i\n", "lines", sum
printf " %-9s: \n", "authors"
for (i = 1; i <= NR; ++i) {
printf " %-30s %2.1f%%\n", args[i], 100 * args[i] / sum
printf " %s, %2.1f%%\n", args[i], 100 * args[i] / sum
}
}
'
' | column -t -s,
}

# summary

echo
echo " project : $project"
echo " lines :" $(count)
echo " authors :"
result
echo