mirror of
https://github.com/git/git.git
synced 2024-11-28 04:23:30 +08:00
Merge branch 'ct/prompt-untracked-fix'
The prompt script (in contrib/) did not show the untracked sign when working in a subdirectory without any untracked files. * ct/prompt-untracked-fix: git prompt: use toplevel to find untracked files
This commit is contained in:
commit
5f15cba2f9
@ -487,7 +487,7 @@ __git_ps1 ()
|
||||
|
||||
if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] &&
|
||||
[ "$(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 --error-unmatch -- ':/*' >/dev/null 2>/dev/null
|
||||
then
|
||||
u="%${ZSH_VERSION+%}"
|
||||
fi
|
||||
|
@ -397,6 +397,17 @@ test_expect_success 'prompt - untracked files status indicator - untracked files
|
||||
test_cmp expected "$actual"
|
||||
'
|
||||
|
||||
test_expect_success 'prompt - untracked files status indicator - untracked files outside cwd' '
|
||||
printf " (master %%)" >expected &&
|
||||
(
|
||||
mkdir -p ignored_dir &&
|
||||
cd ignored_dir &&
|
||||
GIT_PS1_SHOWUNTRACKEDFILES=y &&
|
||||
__git_ps1 >"$actual"
|
||||
) &&
|
||||
test_cmp expected "$actual"
|
||||
'
|
||||
|
||||
test_expect_success 'prompt - untracked files status indicator - shell variable unset with config disabled' '
|
||||
printf " (master)" >expected &&
|
||||
test_config bash.showUntrackedFiles false &&
|
||||
|
Loading…
Reference in New Issue
Block a user