summaryrefslogtreecommitdiff
path: root/git-author-stats
diff options
context:
space:
mode:
Diffstat (limited to 'git-author-stats')
-rwxr-xr-xgit-author-stats21
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
+)