{"thread":{"id":"55679","subject":"[PATCH] git-prompt: work under set -u","startedAt":"2021-05-13T06:22:45Z","lastAt":"2021-05-13T06:22:45Z","messageCount":1,"participants":["Elijah Newren via GitGitGadget"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"424422","messageId":"pull.1024.git.git.1620886957441.gitgitgadget@gmail.com","threadId":"55679","inReplyTo":null,"subject":"[PATCH] git-prompt: work under set -u","fromName":"Elijah Newren via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2021-05-13T06:22:36Z","receivedAt":"2021-05-13T06:22:45Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"From: Elijah Newren <newren@gmail.com>\n\nCommit afda36dbf3 (\"git-prompt: include sparsity state as well\",\n2020-06-21) added the use of some variables to control how to show\nsparsity state in the git prompt, but implicitly assumed that undefined\nvariables would be treated as the empty string.  This breaks users who\nrun under 'set -u'; fix the code to be more explicit.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n    git-prompt: work under set -u\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1024%2Fnewren%2Ffix-git-prompt-under-set-u-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1024/newren/fix-git-prompt-under-set-u-v1\nPull-Request: https://github.com/git/git/pull/1024\n\n contrib/completion/git-prompt.sh | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh\nindex 4640a1535d15..db7c0068fb55 100644\n--- a/contrib/completion/git-prompt.sh\n+++ b/contrib/completion/git-prompt.sh\n@@ -433,8 +433,8 @@ __git_ps1 ()\n \tfi\n \n \tlocal sparse=\"\"\n-\tif [ -z \"${GIT_PS1_COMPRESSSPARSESTATE}\" ] &&\n-\t   [ -z \"${GIT_PS1_OMITSPARSESTATE}\" ] &&\n+\tif [ -z \"${GIT_PS1_COMPRESSSPARSESTATE-}\" ] &&\n+\t   [ -z \"${GIT_PS1_OMITSPARSESTATE-}\" ] &&\n \t   [ \"$(git config --bool core.sparseCheckout)\" = \"true\" ]; then\n \t\tsparse=\"|SPARSE\"\n \tfi\n@@ -543,7 +543,7 @@ __git_ps1 ()\n \t\t\tu=\"%${ZSH_VERSION+%}\"\n \t\tfi\n \n-\t\tif [ -n \"${GIT_PS1_COMPRESSSPARSESTATE}\" ] &&\n+\t\tif [ -n \"${GIT_PS1_COMPRESSSPARSESTATE-}\" ] &&\n \t\t   [ \"$(git config --bool core.sparseCheckout)\" = \"true\" ]; then\n \t\t\th=\"?\"\n \t\tfi\n\nbase-commit: df6c4f722c94641d5a9ea5496511f7043433abc2\n-- \ngitgitgadget\n"}]}