diff options
author | Ben Sima <ben@bsima.me> | 2020-06-24 09:38:26 -0700 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2020-06-24 09:38:26 -0700 |
commit | 7347983866f376e579890834736cc7c9d301bf5a (patch) | |
tree | 1205c4b817bae136f374c0c62388abb238e21aa7 /git-author-stats | |
parent | f7fadfaa9fcb24bbfce31db8a2736d74c7213fd1 (diff) |
git-author-stats: cleanup and add docs
Diffstat (limited to 'git-author-stats')
-rwxr-xr-x | git-author-stats | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/git-author-stats b/git-author-stats index 8bd2d9b..ede4ef2 100755 --- a/git-author-stats +++ b/git-author-stats @@ -1,5 +1,8 @@ #!/usr/bin/env bash - +# +# Print lines added/removed and number of commits by author. Optional arg is a +# path passed to 'git log'. +# script=$(cat << 'EOF' NF == 1 { name = $1; commits[name] += 1 } NF == 3 { plus[name] += $1; minus[name] += $2 } @@ -10,13 +13,9 @@ END { } EOF ) - -(printf $'name\tadded\tremoved\tcommits\n'; - -git log --numstat --pretty=$'%aN' "$@" \ - | awk -F$'\t' "$script" \ - | sort --field-separator=$'\t' -k${ASTATS_SORT_COLUMN:-2} -gr -) > /tmp/git-author-stats - -column -t -s $'\t' /tmp/git-author-stats -rm /tmp/git-author-stats +column -t -s $'\t' <( + printf $'name\tadded\tremoved\tcommits\n'; + git log --numstat --pretty=$'%aN' "$@" \ + | awk -F$'\t' "$script" \ + | sort --field-separator=$'\t' -k${ASTATS_SORT_COLUMN:-2} -gr +) |