shell-prompt: clean up nested if-then

Minor clean up of if-then nesting in checks for environment variables
and config options. No functional changes.

Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Martin Erik Werner
2013-02-18 23:59:03 +01:00
committed by Junio C Hamano
parent 4cb8a83bb8
commit 31e6a4e613

View File

@ -320,26 +320,25 @@ __git_ps1 ()
b="GIT_DIR!" b="GIT_DIR!"
fi fi
elif [ "true" = "$(git rev-parse --is-inside-work-tree 2>/dev/null)" ]; then elif [ "true" = "$(git rev-parse --is-inside-work-tree 2>/dev/null)" ]; then
if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ]; then if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ] &&
if [ "$(git config --bool bash.showDirtyState)" != "false" ]; then [ "$(git config --bool bash.showDirtyState)" != "false" ]
git diff --no-ext-diff --quiet --exit-code || w="*" then
if git rev-parse --quiet --verify HEAD >/dev/null; then git diff --no-ext-diff --quiet --exit-code || w="*"
git diff-index --cached --quiet HEAD -- || i="+" if git rev-parse --quiet --verify HEAD >/dev/null; then
else git diff-index --cached --quiet HEAD -- || i="+"
i="#" else
fi i="#"
fi fi
fi fi
if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ]; then if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ]; then
git rev-parse --verify refs/stash >/dev/null 2>&1 && s="$" git rev-parse --verify refs/stash >/dev/null 2>&1 && s="$"
fi fi
if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ]; then if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] &&
if [ "$(git config --bool bash.showUntrackedFiles)" != "false" ]; then [ "$(git config --bool bash.showUntrackedFiles)" != "false" ] &&
if [ -n "$(git ls-files --others --exclude-standard)" ]; then [ -n "$(git ls-files --others --exclude-standard)" ]
u="%" then
fi u="%"
fi
fi fi
if [ -n "${GIT_PS1_SHOWUPSTREAM-}" ]; then if [ -n "${GIT_PS1_SHOWUPSTREAM-}" ]; then