From 2e213b9b8f96722d4978a80ae53849fec437eb10 Mon Sep 17 00:00:00 2001 From: Yoav Weiss Date: Sun, 27 Jan 2013 14:50:33 +0100 Subject: [PATCH 1/4] Faster dirty git status check (using git diff) --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index 3e14695bd..d818c742d 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -13,7 +13,7 @@ parse_git_dirty() { if [[ $POST_1_7_2_GIT -gt 0 ]]; then SUBMODULE_SYNTAX="--ignore-submodules=dirty" fi - if [[ -n $(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then + if [[ -n $(git diff --ignore-submodules HEAD 2> /dev/null) ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" else echo "$ZSH_THEME_GIT_PROMPT_CLEAN" From 171a76a3c45ac031262e4eb7eaa38cc020a59812 Mon Sep 17 00:00:00 2001 From: Yoav Weiss Date: Wed, 30 Jan 2013 09:32:01 +0100 Subject: [PATCH 2/4] Closer to original status command, using SUBMODULE SYNTAX --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index d818c742d..ccc5d3128 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -13,7 +13,7 @@ parse_git_dirty() { if [[ $POST_1_7_2_GIT -gt 0 ]]; then SUBMODULE_SYNTAX="--ignore-submodules=dirty" fi - if [[ -n $(git diff --ignore-submodules HEAD 2> /dev/null) ]]; then + if [[ -n $(git diff ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" else echo "$ZSH_THEME_GIT_PROMPT_CLEAN" From 11576dd40bfb78379724a9519081365bbd41d7a9 Mon Sep 17 00:00:00 2001 From: Yoav Weiss Date: Wed, 13 Feb 2013 11:28:13 +0100 Subject: [PATCH 3/4] Fixed dirty check to include files added to index --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index ccc5d3128..fde30e2b9 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -13,7 +13,7 @@ parse_git_dirty() { if [[ $POST_1_7_2_GIT -gt 0 ]]; then SUBMODULE_SYNTAX="--ignore-submodules=dirty" fi - if [[ -n $(git diff ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then + if [[ -n $(git diff ${SUBMODULE_SYNTAX} HEAD 2> /dev/null) ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" else echo "$ZSH_THEME_GIT_PROMPT_CLEAN" From 9245a3086843c20ef1880f6d26720db73d5c724d Mon Sep 17 00:00:00 2001 From: Yoav Weiss Date: Wed, 13 Feb 2013 17:14:43 +0100 Subject: [PATCH 4/4] Did a full circle and went back to # On branch master # Changes to be committed: # (use "git reset HEAD ..." to unstage) # # modified: git.zsh #, ignoring untracked files, which seems to be the primary cause for slowness --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index fde30e2b9..ccd329665 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -13,7 +13,7 @@ parse_git_dirty() { if [[ $POST_1_7_2_GIT -gt 0 ]]; then SUBMODULE_SYNTAX="--ignore-submodules=dirty" fi - if [[ -n $(git diff ${SUBMODULE_SYNTAX} HEAD 2> /dev/null) ]]; then + if [[ -n $(git status -s ${SUBMODULE_SYNTAX} -uno 2> /dev/null) ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" else echo "$ZSH_THEME_GIT_PROMPT_CLEAN"