From 322470f415448c163a518e654e1ff40fee588112 Mon Sep 17 00:00:00 2001 From: arzzen Date: Fri, 10 Apr 2026 12:32:28 +0200 Subject: [PATCH] docs: clarify tag-based contributor option behavior --- README.md | 8 ++++++++ git-quick-stats | 29 +++++++++++++++-------------- git-quick-stats.1 | 4 ++++ 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 677f50b..675ebf0 100644 --- a/README.md +++ b/README.md @@ -175,6 +175,14 @@ You can set variable `_GIT_LIMIT` for limited output. It will affect the "change export _GIT_LIMIT=20 ``` +### Git tag + +You can set `_GIT_TAG` to define the default tag used by the "new contributors since tag" option. + +```bash +export _GIT_TAG="foo" +``` + ### Git log options You can set `_GIT_LOG_OPTIONS` for [git log options](https://git-scm.com/docs/git-log#_options): diff --git a/git-quick-stats b/git-quick-stats index 1fd9834..2a55c7a 100755 --- a/git-quick-stats +++ b/git-quick-stats @@ -119,6 +119,9 @@ if ! [[ "$_commit_days" =~ ^[0-9]+$ ]] || (( _commit_days <= 0 )); then _commit_days=30 fi +# Specific git tag +_tag="${_GIT_TAG:-}" + # Default menu theme # Set the legacy theme by typing "export _MENU_THEME=legacy" _theme="${_MENU_THEME:=default}" @@ -1453,15 +1456,14 @@ if [[ "$#" -eq 1 ]]; then done newContributors "${newDate}";; -N|--new-contributors-since-tag) - tag="${_GIT_TAG:-}" - while [[ -z "${tag}" ]]; do - read -r -p "Which tag? " tag - if ! git rev-parse "${tag}" >/dev/null 2>&1; then - echo "Error: Tag '${tag}' does not exist." - tag="" + while [[ -z "${_tag}" ]]; do + read -r -p "Which tag? " _tag + if ! git rev-parse "${_tag}" >/dev/null 2>&1; then + echo "Error: Tag '${_tag}' does not exist." + _tag="" fi done - newContributorsSinceTag "${tag}";; + newContributorsSinceTag "${_tag}";; -a|--commits-per-author) commitsPerAuthor;; -d|--commits-per-day) commitsPerDay;; -Y|--commits-by-year ) commitsByYear;; @@ -1559,15 +1561,14 @@ if [[ "$#" -eq 0 ]]; then fi done newContributors "${newDate}"; showMenu;; - 12) tag="" - while [[ -z "${tag}" ]]; do - read -r -p "Which tag? " tag - if ! git rev-parse "${tag}" >/dev/null 2>&1; then - echo "Error: Tag '${tag}' does not exist." - tag="" + 12) while [[ -z "${_tag}" ]]; do + read -r -p "Which tag? " _tag + if ! git rev-parse "${_tag}" >/dev/null 2>&1; then + echo "Error: Tag '${_tag}' does not exist." + _tag="" fi done - newContributorsSinceTag "${tag}"; showMenu;; + newContributorsSinceTag "${_tag}"; showMenu;; 13) commitsPerAuthor; showMenu;; 14) commitsPerDay; showMenu;; 15) commitsByMonth; showMenu;; diff --git a/git-quick-stats.1 b/git-quick-stats.1 index 47eb931..6faa085 100644 --- a/git-quick-stats.1 +++ b/git-quick-stats.1 @@ -179,6 +179,10 @@ You can set _GIT_LIMIT for limited output log, example: .PP .B export _GIT_LIMIT=20 .PP +You can set _GIT_TAG to define the default tag used by the "new contributors since tag" option, example: +.PP +.B export _GIT_TAG="foo" +.PP You can set _GIT_LOG_OPTIONS for git log options, example: .PP .B export _GIT_LOG_OPTIONS="--ignore-all-space --ignore-blank-lines"