Compare commits

..

6 Commits
1.0.3 ... 1.0.4

Author SHA1 Message Date
Lukáš Mešťan
481bc47482 rename variable _exclude to _pathspec 2017-03-16 11:43:48 +01:00
Lukas Mestan
29bbc98c87 rename _GIT_EXCLUDE to _GIT_PATHSPEC 2017-03-15 20:11:56 +01:00
Lukas Mestan
f344f0dfb7 quote ${_exclude} 2017-03-15 19:09:07 +01:00
Lukas Mestan
8b24e28c95 add _GIT_EXCLUDE, #25 2017-03-15 18:51:00 +01:00
Lukas Mestan
745b995f30 update inline graph 2017-03-07 19:09:36 +01:00
Lukas Mestan
1a7abe3132 fix #24, sort commits by weekday 2017-02-28 20:15:17 +01:00

View File

@@ -13,6 +13,11 @@ if [ ! -z ${_until} ]
then _until="--until=$_until"
fi
_pathspec=${_GIT_PATHSPEC:-}
if [ ! -z "${_pathspec}" ]
then _pathspec="-- . $_pathspec"
fi
_limit=${_GIT_LIMIT:-}
if [ ! -z ${_limit} ]
then _limit=$_limit
@@ -60,7 +65,7 @@ function option_picked() {
function detailedGitStats() {
option_picked "Contribution stats (by author):"
git log --no-merges --numstat --pretty="format:commit %H%nAuthor: %an <%ae>%nDate: %ad%n%n%w(0,4,4)%B%n" $_since $_until | LC_ALL=C awk '
git log --no-merges --numstat --pretty="format:commit %H%nAuthor: %an <%ae>%nDate: %ad%n%n%w(0,4,4)%B%n" $_since $_until $_pathspec | LC_ALL=C awk '
function printStats(author) {
printf "\t%s:\n", author
@@ -81,6 +86,7 @@ function detailedGitStats() {
}
if ( first[author] != "" ) {
printf "\t lines changed: %s\n", more[author] + less[author]
printf "\t first commit: %s\n", first[author]
printf "\t last commit: %s\n", last[author]
}
@@ -122,7 +128,7 @@ function detailedGitStats() {
function suggestReviewers() {
option_picked "Suggested code reviewers (based on git history):"
git log --no-merges $_since $_until --pretty=%an $* | head -n 100 | sort | uniq -c | sort -nr | LC_ALL=C awk '
git log --no-merges $_since $_until --pretty=%an $_pathspec $* | head -n 100 | sort | uniq -c | sort -nr | LC_ALL=C awk '
{ args[NR] = $0; }
END {
for (i = 1; i <= NR; ++i) {
@@ -144,12 +150,13 @@ function commitsByMonth() {
}
END{
for (month in count) {
s="";
s="|";
percent = ((count[month] / total) * 100) / 1.25;
for (i = 1; i <= percent; ++i) {
s=s"="
s=s""
}
printf( "\t%s\t%-0s\t|%s\n", month, count[month], s );
printf( "\t%s\t%-0s\t%s\n", month, count[month], s );
}
}' | LC_TIME="en_EN.UTF-8" sort -M
}
@@ -170,15 +177,16 @@ function commitsByWeekday() {
next
}
END{
for (day in count) {
s="";
s="|";
percent = ((count[day] / total) * 100) / 1.25;
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%-0s\t%s\n", day, count[day], s );
}
}'
}' | sort -k 2 -n -r
}
function commitsByHour() {
@@ -194,19 +202,19 @@ function commitsByHour() {
}
END{
for (hour in count) {
s="";
s="|";
percent = ((count[hour] / total) * 100) / 1.25;
for (i = 1; i <= percent; ++i) {
s=s"="
s=s""
}
printf( "\t%s\t%-0s\t|%s\n", hour, count[hour], s );
printf( "\t%s\t%-0s\t%s\n", hour, count[hour], s );
}
}' | sort
}
function commitsPerDay() {
option_picked "Git commits per date:";
git log --no-merges $_since $_until --date=short --format='%ad' | sort | uniq -c
git log --no-merges $_since $_until --date=short --format='%ad' $_pathspec | sort | uniq -c
}
function commitsPerAuthor() {
@@ -235,12 +243,12 @@ function myDailyStats() {
function contributors() {
option_picked "All contributors (sorted by name):"
git log --no-merges $_since $_until --format='%aN' | sort -u | cat -n
git log --no-merges $_since $_until --format='%aN' $_pathspec | sort -u | cat -n
}
function branchTree() {
option_picked "Branching tree view:"
git log --graph --abbrev-commit $_since $_until --decorate --format=format:'--+ Commit: %h %n | Date: %aD (%ar) %n'' | Message: %s %d %n'' + Author: %an %n' --all | head -n $((_limit*5))
git log --graph --abbrev-commit $_since $_until --decorate --format=format:'--+ Commit: %h %n | Date: %aD (%ar) %n'' | Message: %s %d %n'' + Author: %an %n' --all $_exclude | head -n $((_limit*5))
}
@@ -253,7 +261,7 @@ function changelogs() {
option_picked "Git changelogs:"
NEXT=$(date +%F)
git log --no-merges --format="%cd" --date=short $_since $_until | sort -u -r | head -n $_limit | while read DATE ; do
git log --no-merges --format="%cd" --date=short $_since $_until $_pathspec | sort -u -r | head -n $_limit | while read DATE ; do
echo
echo "[$DATE]"
GIT_PAGER=cat git log --no-merges --format=" * %s" --since=$DATE --until=$NEXT