提交 9bdc5173 编写于 作者: C Cody A Taylor 提交者: Junio C Hamano

git prompt: use toplevel to find untracked files

The __git_ps1() prompt function would not show an untracked state
when all the untracked files are outside the current working
directory.
Signed-off-by: NCody A Taylor <codemister99@yahoo.com>
Helped-by: NSZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 282616c7
......@@ -474,7 +474,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
......
......@@ -395,6 +395,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 &&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册