From 0988f53c701a4b2cc457c15f076f18f1d6f15f43 Mon Sep 17 00:00:00 2001 From: Sam Yu Date: Sat, 5 Aug 2017 10:03:05 +0800 Subject: [PATCH 1/2] Speedup git prompt Fix __fish_git_prompt too slow under repo with lots of untracked files when __fish_git_prompt_showuntrackedfiles enabled. --- share/functions/__fish_git_prompt.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/functions/__fish_git_prompt.fish b/share/functions/__fish_git_prompt.fish index fb0946580..f99fe5a66 100644 --- a/share/functions/__fish_git_prompt.fish +++ b/share/functions/__fish_git_prompt.fish @@ -383,7 +383,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 From 4f5bd08b20f3fe58c2f504eddd9f54cfc8560976 Mon Sep 17 00:00:00 2001 From: Kurtis Rader Date: Sun, 6 Aug 2017 19:53:12 -0700 Subject: [PATCH 2/2] improve `set -U` warning Doing `set -U var` when a global named `var` exists can result in confusing behavior. Try to limit the confusion by improving the warning we write. Also, only write the warning if interactive. Fixes #4267 --- src/builtin_set.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/builtin_set.cpp b/src/builtin_set.cpp index 17ba49ade..6992d00b1 100644 --- a/src/builtin_set.cpp +++ b/src/builtin_set.cpp @@ -694,9 +694,9 @@ int builtin_set(parser_t &parser, io_streams_t &streams, wchar_t **argv) { // Check if we are setting variables above the effective scope. See // https://github.com/fish-shell/fish-shell/issues/806 env_var_t global_dest = env_get_string(dest, ENV_GLOBAL); - if (universal && !global_dest.missing()) { + if (universal && !global_dest.missing() && shell_is_interactive()) { streams.err.append_format( - _(L"%ls: Warning: universal scope selected, but a global variable '%ls' exists.\n"), + _(L"%ls: Universal var '%ls' created but shadowed by global var of the same name.\n"), L"set", dest); }