Skip to content

Commit f148c7c

Browse files
committed
fix author-stats raw mode
1 parent e139564 commit f148c7c

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

git-author-stats

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
#!/bin/bash
22

3-
if [[ "$1" == '--num' ]]; then NUMBERS_ONLY=1; shift; fi
3+
if [[ "$1" == '--raw' ]]; then
4+
RAW=1
5+
shift
6+
fi
47

58
author=$1
69
if [[ -z "$author" ]]; then
710
echo "Usage: git author-stats [author name]"
811
exit
912
fi
1013

11-
git log --author="$author" --pretty=tformat: --numstat | awk '{
14+
git log --author="$author" --pretty=tformat: --numstat | awk -v RAW=$RAW '{
1215
added += $1;
1316
removed += $2;
1417
modified += $1 - -$2;
1518
total += $1 - $2;
1619
} END {
17-
if (NUMBERS_ONLY)
18-
printf "Added: %s, removed: %s, total: %s, modified: %s lines\n", added, removed, total, modified
19-
else
20+
if (RAW)
2021
printf "%s %s %s %s", added, removed, total, modified
22+
else
23+
printf "Added: %s, removed: %s, total: %s, modified: %s lines\n", added, removed, total, modified
2124
}'

git-rank

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Z='\x1b[0m'
1111
printf "\n%-40s %9s %9s %9s %9s %9s\n" AUTHOR COMMITS ADDED REMOVED TOTAL MODIFIED
1212

1313
git shortlog -s -n | while read commits name; do
14-
read added removed total modified < <(git author-stats --num "$name")
14+
read added removed total modified < <(git author-stats --raw "$name")
1515
if type iconv >/dev/null 2>&1; then
1616
name=$(echo $name | iconv -f utf-8 -t ascii//translit)
1717
fi

0 commit comments

Comments
 (0)