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"
Diff
1diff --git a/lib/git.zsh b/lib/git.zsh
2index 640561e97563e1aeffde3a9067674213e439a5ac..e8ef0d78d4c5e201febbc1929bddd06329f18f5e 100644
3--- a/lib/git.zsh
4+++ b/lib/git.zsh
5@@ -17,6 +17,19 @@ function parse_git_dirty() {
6 if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then
7 FLAGS+='--untracked-files=no'
8 fi
9+ case "$GIT_STATUS_IGNORE_SUBMODULES" in
10+ "")
11+ # if unset: ignore dirty submodules
12+ FLAGS+="--ignore-submodules=dirty"
13+ ;;
14+ "git")
15+ # let git decide (this respects per-repo config in .gitmodules)
16+ ;;
17+ *)
18+ # other values are passed to --ignore-submodules
19+ FLAGS+="--ignore-submodules=$GIT_STATUS_IGNORE_SUBMODULES"
20+ ;;
21+ esac
22 STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1)
23 fi
24 if [[ -n $STATUS ]]; then