summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2021-05-13 06:22:36 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-05-13 06:50:26 (GMT)
commit5c0cbdb107c5e1c1474618535fda438f25d260ca (patch)
tree51e7677789a2b88d888a18ec2b2d110010c880a2 /contrib
parent48bf2fa8bad054d66bd79c6ba903c89c704201f7 (diff)
downloadgit-5c0cbdb107c5e1c1474618535fda438f25d260ca.zip
git-5c0cbdb107c5e1c1474618535fda438f25d260ca.tar.gz
git-5c0cbdb107c5e1c1474618535fda438f25d260ca.tar.bz2
git-prompt: work under set -u
Commit afda36dbf3 ("git-prompt: include sparsity state as well", 2020-06-21) added the use of some variables to control how to show sparsity state in the git prompt, but implicitly assumed that undefined variables would be treated as the empty string. This breaks users who run under 'set -u'; fix the code to be more explicit. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib')
-rw-r--r--contrib/completion/git-prompt.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index 4640a15..db7c006 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -433,8 +433,8 @@ __git_ps1 ()
fi
local sparse=""
- if [ -z "${GIT_PS1_COMPRESSSPARSESTATE}" ] &&
- [ -z "${GIT_PS1_OMITSPARSESTATE}" ] &&
+ if [ -z "${GIT_PS1_COMPRESSSPARSESTATE-}" ] &&
+ [ -z "${GIT_PS1_OMITSPARSESTATE-}" ] &&
[ "$(git config --bool core.sparseCheckout)" = "true" ]; then
sparse="|SPARSE"
fi
@@ -543,7 +543,7 @@ __git_ps1 ()
u="%${ZSH_VERSION+%}"
fi
- if [ -n "${GIT_PS1_COMPRESSSPARSESTATE}" ] &&
+ if [ -n "${GIT_PS1_COMPRESSSPARSESTATE-}" ] &&
[ "$(git config --bool core.sparseCheckout)" = "true" ]; then
h="?"
fi