Compare commits

...

6 Commits

Author SHA1 Message Date
Lukáš Mešťan
9e18cf35d4 Merge pull request #94 from arzzen/patch-issue-91
Update commitsByWeekday sorting
2020-02-18 11:31:35 +01:00
Lukáš Mešťan
24ae67ae57 update commitsByWeekday sorting
Fix inconsistent sum sorting in by-weekday, #91
2020-02-14 09:34:46 +01:00
Lukáš Mešťan
ed0e3cbb6b Merge pull request #93 from tomice/master
Fixing OS X compatibility with merge feature
2020-02-13 09:42:06 +01:00
Tom Ice
46a771138e Fixing OS X compatibility with merge feature
* OS X utilizes an older version of GNU Bash. As such, certain features
  such as lowercase expansion can fail. This commit removes the Bash 4.0
  syntax in favor of a POSIX syntax with awk.
2020-02-11 08:25:44 -05:00
Lukáš Mešťan
9f54b87ed5 Update FUNDING.yml 2020-02-05 09:33:07 +00:00
Lukáš Mešťan
246076f5f6 Bump year 2020-01-20 08:00:06 +00:00
3 changed files with 12 additions and 10 deletions

1
.github/FUNDING.yml vendored
View File

@@ -2,3 +2,4 @@
github: [arzzen] github: [arzzen]
open_collective: git-quick-stats open_collective: git-quick-stats
custom: ['https://lukasmestan.com/thanks/']

View File

@@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2019 Lukáš Mešťan Copyright (c) 2020 Lukáš Mešťan
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@@ -23,9 +23,10 @@ _pathspec=${_GIT_PATHSPEC:-}
# Exclusive shows only merge commits # Exclusive shows only merge commits
# Enable shows regular commits together with normal commits # Enable shows regular commits together with normal commits
_merges=${_GIT_MERGE_VIEW:-} _merges=${_GIT_MERGE_VIEW:-}
if [[ "${_merges,,}" == "exclusive" ]]; then _merges=$(echo "$_merges" | awk '{print tolower($0)}')
if [[ "${_merges}" == "exclusive" ]]; then
_merges="--merges" _merges="--merges"
elif [[ "${_merges,,}" == "enable" ]]; then elif [[ "${_merges}" == "enable" ]]; then
_merges="" _merges=""
else else
_merges="--no-merges" _merges="--no-merges"
@@ -376,21 +377,21 @@ function commitsByMonth() {
function commitsByWeekday() { function commitsByWeekday() {
optionPicked "Git commits by weekday:" optionPicked "Git commits by weekday:"
echo -e "\tday\tsum" echo -e "\tday\tsum"
local counter=1
for i in Mon Tue Wed Thu Fri Sat Sun for i in Mon Tue Wed Thu Fri Sat Sun
do do
echo -en "\t$i\t" echo -en "\t$counter\t$i\t"
git -c log.showSignature=false shortlog -n $_merges --format='%ad %s' \ git -c log.showSignature=false shortlog -n $_merges --format='%ad %s' \
$_since $_until | grep "$i " | wc -l $_since $_until | grep "$i " | wc -l
counter=$((counter+1))
done | awk '{ done | awk '{
} }
NR == FNR { NR == FNR {
count[$1] = $2; count[$1" "$2] = $3;
total += $2; total += $3;
next next
} }
END{ END{
for (day in count) { for (day in count) {
s="|"; s="|";
if (total > 0) { if (total > 0) {
@@ -398,10 +399,10 @@ function commitsByWeekday() {
for (i = 1; i <= percent; ++i) { for (i = 1; i <= percent; ++i) {
s=s"█" s=s"█"
} }
printf( "\t%s\t%-0s\t%s\n", day, count[day], s ); printf("\t%s\t%s\t%-0s\t%s\n", substr(day,0,1), substr(day,3,5), count[day], s);
} }
} }
}' | sort -k 2 -n -r }' | sort -k 1 -n | awk '{$1=""}1' | awk '{$1=$1}1' | awk '{printf("\t%s\t%s\t%s\n", $1, $2, $3)}'
} }
################################################################################ ################################################################################