From c7756455cb47dccaf08a53fcc06a5ad5e5b27f0e Mon Sep 17 00:00:00 2001
From: Tobias Fendin
Date: Tue, 26 Apr 2022 15:45:59 +0200
Subject: [PATCH 1/5] Added config git-extras.standup-implicit-week for git
standup
---
bin/git-standup | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/bin/git-standup b/bin/git-standup
index c32c921..63946ed 100755
--- a/bin/git-standup
+++ b/bin/git-standup
@@ -149,13 +149,26 @@ if [[ $# -gt 0 ]]; then
fi
AUTHOR=${AUTHOR:="$(git config user.name)"}
-SINCE=${SINCE:=yesterday}
-UNTIL=${UNTIL:=today}
FETCH_LAST_COMMIT=${FETCH_LAST_COMMIT:=false}
MAXDEPTH=${MAXDEPTH:=2}
GIT_PRETTY_FORMAT="%Cred%h%Creset - %s %Cgreen(%cd) %C(bold blue)<%an>%Creset $GIT_PRETTY_FORMAT"
GIT_DATE_FORMAT=${GIT_DATE_FORMAT:=relative}
+# Handle config of implicit week
+if [[ -z "$SINCE" ]] && [[ -z "$UNTIL" ]] && [[ -n "$(git config --get git-extras.standup-implicit-week)" ]]; then
+ week_range=$(git config --get git-extras.standup-implicit-week)
+ week_start=${week_range%%-*}
+ week_end=${week_range##*-}
+ shopt -s nocasematch
+ if [[ "$week_start" == "$(LC_ALL=C date +%a)" ]]; then
+ SINCE="last $week_end"
+ fi
+ UNTIL=today
+else
+ SINCE=${SINCE:=yesterday}
+ UNTIL=${UNTIL:=today}
+fi
+
GIT_LOG_COMMAND="git --no-pager log \
--no-merges
--since \"$SINCE\"
From 7cb5c55e133449605c52449375bed613319ea3e9 Mon Sep 17 00:00:00 2001
From: Tobias Fendin
Date: Fri, 29 Apr 2022 09:56:26 +0200
Subject: [PATCH 2/5] Renamed config git-extras.standup.implicit-week from
git-extras.standup-implicit-week
---
bin/git-standup | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/bin/git-standup b/bin/git-standup
index 63946ed..787a13a 100755
--- a/bin/git-standup
+++ b/bin/git-standup
@@ -155,8 +155,8 @@ GIT_PRETTY_FORMAT="%Cred%h%Creset - %s %Cgreen(%cd) %C(bold blue)<%an>%Creset $G
GIT_DATE_FORMAT=${GIT_DATE_FORMAT:=relative}
# Handle config of implicit week
-if [[ -z "$SINCE" ]] && [[ -z "$UNTIL" ]] && [[ -n "$(git config --get git-extras.standup-implicit-week)" ]]; then
- week_range=$(git config --get git-extras.standup-implicit-week)
+if [[ -z "$SINCE" ]] && [[ -z "$UNTIL" ]] && [[ -n "$(git config --get git-extras.standup.implicit-week)" ]]; then
+ week_range=$(git config --get git-extras.standup.implicit-week)
week_start=${week_range%%-*}
week_end=${week_range##*-}
shopt -s nocasematch
From 745c7ab50026b2cebb5d5c36484e0b4b4e6da3ae Mon Sep 17 00:00:00 2001
From: Tobias Fendin
Date: Fri, 29 Apr 2022 11:04:04 +0200
Subject: [PATCH 3/5] Improved check if -w or -d was given to git standup
---
bin/git-standup | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/bin/git-standup b/bin/git-standup
index 787a13a..6ab1774 100755
--- a/bin/git-standup
+++ b/bin/git-standup
@@ -63,6 +63,8 @@ fi
# which may fail on systems lacking tput or terminfo
set -e
+RANGE_SPECIFIED=
+
while getopts "hgfBd:a:w:m:D:n:L" opt; do
case $opt in
h)
@@ -77,7 +79,8 @@ while getopts "hgfBd:a:w:m:D:n:L" opt; do
fi
;;
d)
- test -n "$SINCE" && warn "-d option is conflict with -w"
+ test -n "$RANGE_SPECIFIED" && warn "-d option is conflict with -w"
+ RANGE_SPECIFIED=yes
if [ "$OPTARG" -lt 1 ]; then
>&2 echo "Specify days less than one is invalid"
exit 1
@@ -85,10 +88,11 @@ while getopts "hgfBd:a:w:m:D:n:L" opt; do
SINCE="$OPTARG days ago"
;;
w)
- if [ -n "$SINCE" ]; then
+ if [ -n "$RANGE_SPECIFIED" ]; then
warn "-w option is conflict with -d"
continue
fi
+ RANGE_SPECIFIED=yes
week_range=${OPTARG}
week_start="${week_range%%-*}"
@@ -155,7 +159,7 @@ GIT_PRETTY_FORMAT="%Cred%h%Creset - %s %Cgreen(%cd) %C(bold blue)<%an>%Creset $G
GIT_DATE_FORMAT=${GIT_DATE_FORMAT:=relative}
# Handle config of implicit week
-if [[ -z "$SINCE" ]] && [[ -z "$UNTIL" ]] && [[ -n "$(git config --get git-extras.standup.implicit-week)" ]]; then
+if [[ -z "$RANGE_SPECIFIED" ]] && [[ -n "$(git config --get git-extras.standup.implicit-week)" ]]; then
week_range=$(git config --get git-extras.standup.implicit-week)
week_start=${week_range%%-*}
week_end=${week_range##*-}
From f334dff09c353bfc803427f5c27fc0249854f47b Mon Sep 17 00:00:00 2001
From: Tobias Fendin
Date: Fri, 29 Apr 2022 14:01:10 +0200
Subject: [PATCH 4/5] Documented config git-extras.standup.implicit-week
---
man/git-standup.1 | 9 ++++++++-
man/git-standup.html | 11 ++++++++++-
man/git-standup.md | 7 +++++++
3 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/man/git-standup.1 b/man/git-standup.1
index 2c992e8..8d929fd 100644
--- a/man/git-standup.1
+++ b/man/git-standup.1
@@ -1,6 +1,6 @@
.\" generated with Ronn-NG/v0.9.1
.\" http://github.com/apjanke/ronn-ng/tree/0.9.1
-.TH "GIT\-STANDUP" "1" "August 2021" "" "Git Extras"
+.TH "GIT\-STANDUP" "1" "April 2022" "" "Git Extras"
.SH "NAME"
\fBgit\-standup\fR \- Recall the commit history
.SH "SYNOPSIS"
@@ -51,6 +51,13 @@ Display the commits in branch groups\.
\-n number\-of\-commits
.P
Limit the number of commits displayed per group\. By default, the limitation is applied in the repository level\. For example, if you have 3 repositories under the current directory, \fBgit standup \|\.\|\.\|\. \-n 1\fR will show you 3 commits at most\. When \fB\-B\fR is specific, the limitation is applied in the branch level\. For instance, if each of your 3 repositories have 2 branches, \fBgit standup \|\.\|\.\|\. \-B \-n 1\fR will display 6 commits at most\.
+.SH "GIT CONFIGS"
+You can configure a implicit \-w \fIweekstart\-weekend\fR, which is superseded if \-w or \-d is given on the command line\. Note that the \fIweekstart\-weekend\fR must be specified, they don\'t have any default values as the \fB\-w\fR flag has\.
+.IP "" 4
+.nf
+$ git config \-\-global git\-extras\.standup\.implicit\-week "Mon\-Fri"
+.fi
+.IP "" 0
.SH "EXAMPLES"
This shows your commits since yesterday:
.IP "" 4
diff --git a/man/git-standup.html b/man/git-standup.html
index 0d17140..47c08e0 100644
--- a/man/git-standup.html
+++ b/man/git-standup.html
@@ -57,6 +57,7 @@
SYNOPSIS
DESCRIPTION
OPTIONS
+ GIT CONFIGS
EXAMPLES
AUTHOR
REPORTING BUGS
@@ -136,6 +137,14 @@ When -B is specific, the limitation is applied in the branch level
if each of your 3 repositories have 2 branches, git standup ... -B -n 1 will
display 6 commits at most.
+GIT CONFIGS
+
+You can configure a implicit -w weekstart-weekend, which is superseded if -w or -d is given on the command line.
+Note that the weekstart-weekend must be specified, they don't have any default values as the -w flag has.
+
+$ git config --global git-extras.standup.implicit-week "Mon-Fri"
+
+
EXAMPLES
This shows your commits since yesterday:
@@ -198,7 +207,7 @@ master
diff --git a/man/git-standup.md b/man/git-standup.md
index 8cc30fe..8fa8660 100644
--- a/man/git-standup.md
+++ b/man/git-standup.md
@@ -62,6 +62,13 @@ When `-B` is specific, the limitation is applied in the branch level. For insta
if each of your 3 repositories have 2 branches, `git standup ... -B -n 1` will
display 6 commits at most.
+## GIT CONFIGS
+
+You can configure a implicit -w , which is superseded if -w or -d is given on the command line.
+Note that the must be specified, they don't have any default values as the `-w` flag has.
+
+ $ git config --global git-extras.standup.implicit-week "Mon-Fri"
+
## EXAMPLES
This shows your commits since yesterday:
From 0701c9e4d7b05278cbb084c5610f7771f2ed553d Mon Sep 17 00:00:00 2001
From: Tobias Fendin
Date: Sat, 7 May 2022 12:31:16 +0200
Subject: [PATCH 5/5] Don't read git-extras.standup.implicit-week twice in git
standup
---
bin/git-standup | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/bin/git-standup b/bin/git-standup
index 6ab1774..71f8cca 100755
--- a/bin/git-standup
+++ b/bin/git-standup
@@ -159,10 +159,10 @@ GIT_PRETTY_FORMAT="%Cred%h%Creset - %s %Cgreen(%cd) %C(bold blue)<%an>%Creset $G
GIT_DATE_FORMAT=${GIT_DATE_FORMAT:=relative}
# Handle config of implicit week
-if [[ -z "$RANGE_SPECIFIED" ]] && [[ -n "$(git config --get git-extras.standup.implicit-week)" ]]; then
- week_range=$(git config --get git-extras.standup.implicit-week)
- week_start=${week_range%%-*}
- week_end=${week_range##*-}
+IMPLICIT_WEEK=$(git config --get git-extras.standup.implicit-week)
+if [[ -z "$RANGE_SPECIFIED" ]] && [[ -n "${IMPLICIT_WEEK}" ]]; then
+ week_start=${IMPLICIT_WEEK%%-*}
+ week_end=${IMPLICIT_WEEK##*-}
shopt -s nocasematch
if [[ "$week_start" == "$(LC_ALL=C date +%a)" ]]; then
SINCE="last $week_end"