Speedup git prompt

Fix __fish_git_prompt too slow under repo with lots of untracked
files when __fish_git_prompt_showuntrackedfiles enabled.
This commit is contained in:
Sam Yu 2017-08-05 10:03:05 +08:00 committed by Kurtis Rader
parent 74fd29fc5c
commit d87c0424d8

View file

@ -382,7 +382,7 @@ function __fish_git_prompt --description "Prompt function for Git"
if set -q __fish_git_prompt_showuntrackedfiles
set -l config (command git config --bool bash.showUntrackedFiles)
if test "$config" != false
if command git ls-files --others --exclude-standard --error-unmatch -- '*' >/dev/null ^/dev/null
if command git ls-files --others --exclude-standard --directory --no-empty-directory --error-unmatch -- '*' >/dev/null ^/dev/null
set u $___fish_git_prompt_char_untrackedfiles
end
end