diff options
| author | Teddy Wing | 2015-08-20 00:31:39 -0400 |
|---|---|---|
| committer | Teddy Wing | 2015-08-20 00:31:39 -0400 |
| commit | 1190ae67efa2fab3fee81708dece53d9e5a90486 (patch) | |
| tree | 4c93671d1b6976e51c17f021fc39e3d41d4186e6 | |
| parent | 83027388670b18143593eef5f171925c97464a3a (diff) | |
| download | git-stats-1190ae67efa2fab3fee81708dece53d9e5a90486.tar.bz2 | |
git-stats.sh: Days since first commit graph (fix 83027388)
Fix commit 83027388670b18143593eef5f171925c97464a3a.
* Uncomment commit message word count graph (I had commented it out
because it takes a long time)
* Turn the 'days since first commit' graph back on an remove debug lines
* Remove spaces around date parse call in Ruby line
* Comment out Bash pipefail settings. This was causing the 'days since
first commit' graph to fail and was part of the reason for the issue I
was seeing in 83027388670b18143593eef5f171925c97464a3a. The trouble
was that the `git log --pretty` call was returning a non-zero exit
code (as far as I can tell), causing the program to exit before
processing all the contributors. Remove the Bash settings as a stopgap
because the script seems to work fine now.
| -rwxr-xr-x | git-stats.sh | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/git-stats.sh b/git-stats.sh index f9027d6..cbb45cd 100755 --- a/git-stats.sh +++ b/git-stats.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -euo pipefail +# set -euo pipefail IFS=$'\n\t' function usage () { @@ -32,21 +32,17 @@ echo "$colon_separated_shortlog" | asciigraph -l 'Commit count' --color contributors=$(echo "$colon_separated_shortlog" | cut -d: -f 1) -# for name in $contributors; do -# colon_separated_commit_word_count+=$name:$(git log --pretty='format:%B' --no-merges --author="$name" | wc -w | tr -d '[[:space:]]')$'\n' -# done -# -# echo -n "$colon_separated_commit_word_count" | asciigraph -l 'Commit message word count' --color --sort=dec +for name in $contributors; do + colon_separated_commit_word_count+=$name:$(git log --pretty='format:%B' --no-merges --author="$name" | wc -w | tr -d '[[:space:]]')$'\n' +done + +echo -n "$colon_separated_commit_word_count" | asciigraph -l 'Commit message word count' --color --sort=dec while read -r name; do - echo $name - # echo $(git log --reverse --pretty='format:%ad' --author=""$name"" | head -n 1) - first_commit_date=$(git log --reverse --pretty='format:%ad' --author="$name" | head -n 1) - echo $first_commit_date - # days_since_first_commit=$(ruby -e 'require "date"; date = Date.parse("' $first_commit_date '"); puts (Date.today - date).to_i') - # colon_separated_days_since_first_commit+=$name:$days_since_first_commit$'\n' + first_commit_date=$(git --no-pager log --reverse --pretty='format:%ad' --author=""$name"" | head -n 1) + days_since_first_commit=$(ruby -e 'require "date"; date = Date.parse("'$first_commit_date'"); puts (Date.today - date).to_i') + colon_separated_days_since_first_commit+=$name:$days_since_first_commit$'\n' done <<< "$contributors" -# echo -n "$colon_separated_days_since_first_commit" -# echo -n "$colon_separated_days_since_first_commit" | asciigraph -l 'Days since first commit' --color --sort=dec +echo -n "$colon_separated_days_since_first_commit" | asciigraph -l 'Days since first commit' --color --sort=dec |
