From 7cc3a32bff9b283bf5eea139b92cbfddf3b75de5 Mon Sep 17 00:00:00 2001 From: Wang Guan Date: Thu, 31 Oct 2013 05:46:27 +0900 Subject: [PATCH 1/2] Add an option about git submodules to ignore $GIT_STATUS_IGNORE_SUBMODULES can be used to specify handling of submodules. It can be: not set : ignore dirty submodules (this was default zsh behavior) "git" : do not use "--ignore-submodules" and let git choose, this obeys setting in .gitmodules other : comes into "--ignore-submodules=$GIT_STATUS_IGNORE_SUBMODULES" --- lib/git.zsh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/git.zsh b/lib/git.zsh index 640561e97..e8ef0d78d 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -17,6 +17,19 @@ function parse_git_dirty() { if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then FLAGS+='--untracked-files=no' fi + case "$GIT_STATUS_IGNORE_SUBMODULES" in + "") + # if unset: ignore dirty submodules + FLAGS+="--ignore-submodules=dirty" + ;; + "git") + # let git decide (this respects per-repo config in .gitmodules) + ;; + *) + # other values are passed to --ignore-submodules + FLAGS+="--ignore-submodules=$GIT_STATUS_IGNORE_SUBMODULES" + ;; + esac STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1) fi if [[ -n $STATUS ]]; then From b7e37cea90b2bc718c66f90c0f9d52d1aa49ca79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 6 Nov 2019 19:41:13 +0100 Subject: [PATCH 2/2] Clean up ignore submodules logic in parse_git_dirty --- lib/git.zsh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/git.zsh b/lib/git.zsh index e8ef0d78d..7affdec68 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -18,16 +18,13 @@ function parse_git_dirty() { FLAGS+='--untracked-files=no' fi case "$GIT_STATUS_IGNORE_SUBMODULES" in - "") - # if unset: ignore dirty submodules - FLAGS+="--ignore-submodules=dirty" - ;; - "git") + git) # let git decide (this respects per-repo config in .gitmodules) ;; *) + # if unset: ignore dirty submodules # other values are passed to --ignore-submodules - FLAGS+="--ignore-submodules=$GIT_STATUS_IGNORE_SUBMODULES" + FLAGS+="--ignore-submodules=${GIT_STATUS_IGNORE_SUBMODULES:-dirty}" ;; esac STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1)