From 7347983866f376e579890834736cc7c9d301bf5a Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Wed, 24 Jun 2020 09:38:26 -0700 Subject: git-author-stats: cleanup and add docs --- git-author-stats | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'git-author-stats') 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 +) -- cgit v1.2.3