Added option to allow untracked files as non dirty
In this commit, the option only works for git but it should not be to hard for
someone who knows svn to so the same.
This commit is largely inspired by @yoavweiss, I only added an option to use
it.
Diff
1diff --git a/lib/git.zsh b/lib/git.zsh
2index 76fe9b142cb35fb8d88f5a9e9cf9830ff5abb333..5f8453112412c693055a0de8a1b552bbd9eeb285 100644
3--- a/lib/git.zsh
4+++ b/lib/git.zsh
5@@ -15,7 +15,11 @@ parse_git_dirty() {
6 if [[ $POST_1_7_2_GIT -gt 0 ]]; then
7 SUBMODULE_SYNTAX="--ignore-submodules=dirty"
8 fi
9- GIT_STATUS=$(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null | tail -n1)
10+ if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" != "true" ]]; then
11+ GIT_STATUS=$(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null | tail -n1)
12+ else
13+ GIT_STATUS=$(git status -s ${SUBMODULE_SYNTAX} -uno 2> /dev/null | tail -n1)
14+ fi
15 if [[ -n $GIT_STATUS && "$GIT_STATUS" != "$CLEAN_MESSAGE" ]]; then
16 echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
17 else
18diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template
19index 2ea9934af1bc1d27f6f8b8fb2d3f9ecb56128bfb..58f193550e23453105d23820ab39585052ddac44 100644
20--- a/templates/zshrc.zsh-template
21+++ b/templates/zshrc.zsh-template
22@@ -29,6 +29,11 @@ ZSH_THEME="robbyrussell"
23 # Uncomment following line if you want red dots to be displayed while waiting for completion
24 # COMPLETION_WAITING_DOTS="true"
2526+# Uncomment following line if you want to disable marking untracked files under
27+# VCS as dirty. This makes repository status check for large repositories much,
28+# much faster.
29+# DISABLE_UNTRACKED_FILES_DIRTY="true"
30+
31 # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
32 # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
33 # Example format: plugins=(rails git textmate ruby lighthouse)