Merge branch 'sg/bash-prompt-untracked-optim'
Optimize computation of untracked status indicator by bash prompt script (in contrib/). * sg/bash-prompt-untracked-optim: bash prompt: faster untracked status indicator with untracked directories bash prompt: test untracked files status indicator with untracked dirs
This commit is contained in:
commit
461c119739
@ -491,7 +491,7 @@ __git_ps1 ()
|
|||||||
|
|
||||||
if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] &&
|
if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] &&
|
||||||
[ "$(git config --bool bash.showUntrackedFiles)" != "false" ] &&
|
[ "$(git config --bool bash.showUntrackedFiles)" != "false" ] &&
|
||||||
git ls-files --others --exclude-standard --error-unmatch -- ':/*' >/dev/null 2>/dev/null
|
git ls-files --others --exclude-standard --directory --no-empty-directory --error-unmatch -- ':/*' >/dev/null 2>/dev/null
|
||||||
then
|
then
|
||||||
u="%${ZSH_VERSION+%}"
|
u="%${ZSH_VERSION+%}"
|
||||||
fi
|
fi
|
||||||
|
@ -397,6 +397,31 @@ test_expect_success 'prompt - untracked files status indicator - untracked files
|
|||||||
test_cmp expected "$actual"
|
test_cmp expected "$actual"
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'prompt - untracked files status indicator - empty untracked dir' '
|
||||||
|
printf " (master)" >expected &&
|
||||||
|
mkdir otherrepo/untracked-dir &&
|
||||||
|
test_when_finished "rm -rf otherrepo/untracked-dir" &&
|
||||||
|
(
|
||||||
|
GIT_PS1_SHOWUNTRACKEDFILES=y &&
|
||||||
|
cd otherrepo &&
|
||||||
|
__git_ps1 >"$actual"
|
||||||
|
) &&
|
||||||
|
test_cmp expected "$actual"
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'prompt - untracked files status indicator - non-empty untracked dir' '
|
||||||
|
printf " (master %%)" >expected &&
|
||||||
|
mkdir otherrepo/untracked-dir &&
|
||||||
|
test_when_finished "rm -rf otherrepo/untracked-dir" &&
|
||||||
|
>otherrepo/untracked-dir/untracked-file &&
|
||||||
|
(
|
||||||
|
GIT_PS1_SHOWUNTRACKEDFILES=y &&
|
||||||
|
cd otherrepo &&
|
||||||
|
__git_ps1 >"$actual"
|
||||||
|
) &&
|
||||||
|
test_cmp expected "$actual"
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'prompt - untracked files status indicator - untracked files outside cwd' '
|
test_expect_success 'prompt - untracked files status indicator - untracked files outside cwd' '
|
||||||
printf " (master %%)" >expected &&
|
printf " (master %%)" >expected &&
|
||||||
(
|
(
|
||||||
|
Loading…
Reference in New Issue
Block a user