bash prompt: avoid command substitution when checking for untracked files
When enabled, the bash prompt can indicate the presence of untracked files with a '%' sign. __git_ps1() checks for untracked files by running the '$(git ls-files --others --exclude-standard)' command substitution, and displays the indicator when there is no output. Avoid this command substitution by additionally passing '--error-unmatch *', and checking the command's return value. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
This commit is contained in:
parent
dd0b72cbd9
commit
14d7649748
@ -442,7 +442,7 @@ __git_ps1 ()
|
||||
|
||||
if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] &&
|
||||
[ "$(git config --bool bash.showUntrackedFiles)" != "false" ] &&
|
||||
[ -n "$(git ls-files --others --exclude-standard)" ]
|
||||
git ls-files --others --exclude-standard --error-unmatch -- '*' >/dev/null 2>/dev/null
|
||||
then
|
||||
u="%${ZSH_VERSION+%}"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user