/usr/bin/git-line-summary is in git-extras 1.9.1-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | #!/bin/bash
project=${PWD##*/}
#
# 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';
fi
done
}
#
# list the author for all file
#
function lines {
git ls-files | single_file
}
#
# count the line count
#
function count {
lines | wc -l
}
#
# sort by author modified lines
#
function authors {
lines | sort | uniq -c | sort -rn
}
#
# list as percentage for author modified lines
#
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
}
}
'
}
# summary
echo
echo " project : $project"
result
echo
|