summaryrefslogtreecommitdiff
path: root/lib/git.zsh
diff options
context:
space:
mode:
authorWang Guan <momocraft@gmail.com>2013-10-31 05:46:27 +0900
committerMarc Cornellà <marc.cornella@live.com>2019-11-06 19:39:17 +0100
commit7cc3a32bff9b283bf5eea139b92cbfddf3b75de5 (patch)
tree30d740ba00aefa62965a159caf8ae14f1d4873b4 /lib/git.zsh
parent0ec59e25c7f6ac11d0988082fef908ff753126a2 (diff)
downloadzsh-7cc3a32bff9b283bf5eea139b92cbfddf3b75de5.tar.gz
zsh-7cc3a32bff9b283bf5eea139b92cbfddf3b75de5.tar.bz2
zsh-7cc3a32bff9b283bf5eea139b92cbfddf3b75de5.zip
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"
Diffstat (limited to 'lib/git.zsh')
-rw-r--r--lib/git.zsh13
1 files changed, 13 insertions, 0 deletions
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