{"thread":{"id":"55678","subject":"git-sh-prompt: bash: GIT_PS1_COMPRESSSPARSESTATE: unbound variable","startedAt":"2021-05-13T03:38:34Z","lastAt":"2021-05-20T00:09:54Z","messageCount":9,"participants":["Christoph Anton Mitterer","Junio C Hamano","Elijah Newren"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"424411","messageId":"f1fc174b10ca5bc8b54ede513bc79e3864d8e014.camel@scientia.net","threadId":"55678","inReplyTo":null,"subject":"git-sh-prompt: bash: GIT_PS1_COMPRESSSPARSESTATE: unbound variable","fromName":"Christoph Anton Mitterer","fromEmail":"calestyo@scientia.net","sentAt":"2021-05-13T03:38:18Z","receivedAt":"2021-05-13T03:38:34Z","isPatch":false,"sender":{"key":"calestyo@scientia.net","avatar":"https://gravatar.com/avatar/74cd78048081efac1fcd21e681751ed55968f949a50e33adbe1a41c572a605cd?d=mp&s=160"},"body":"Hey there.\n\nCould it be that git-sh-prompt no longer works properly?\n\nWith git 2.31.1:\n$ . /usr/lib/git-core/git-sh-prompt\n$ PS1='[\\u@\\h \\W$(__git_ps1 \" (%s)\")]\\$ '\n$ cd someGitRepo\nbash: GIT_PS1_COMPRESSSPARSESTATE: unbound variable\n$ \n\n\nCheers,\nChris.\n\n"},{"id":"424413","messageId":"xmqq4kf7cmaj.fsf@gitster.g","threadId":"55678","inReplyTo":"f1fc174b10ca5bc8b54ede513bc79e3864d8e014.camel@scientia.net","subject":"Re: git-sh-prompt: bash: GIT_PS1_COMPRESSSPARSESTATE: unbound variable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-05-13T04:03:48Z","receivedAt":"2021-05-13T04:03:55Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Christoph Anton Mitterer <calestyo@scientia.net> writes:\n\n> Could it be that git-sh-prompt no longer works properly?\n>\n> With git 2.31.1:\n> $ . /usr/lib/git-core/git-sh-prompt\n> $ PS1='[\\u@\\h \\W$(__git_ps1 \" (%s)\")]\\$ '\n> $ cd someGitRepo\n> bash: GIT_PS1_COMPRESSSPARSESTATE: unbound variable\n> $ \n\nWould\n\n    $ set +u\n\nfix it, I have to wonder?\n\n"},{"id":"424416","messageId":"xmqqzgwzb7ad.fsf@gitster.g","threadId":"55678","inReplyTo":"xmqq4kf7cmaj.fsf@gitster.g","subject":"Re: git-sh-prompt: bash: GIT_PS1_COMPRESSSPARSESTATE: unbound variable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-05-13T04:13:14Z","receivedAt":"2021-05-13T04:13:25Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Christoph Anton Mitterer <calestyo@scientia.net> writes:\n>\n>> Could it be that git-sh-prompt no longer works properly?\n>>\n>> With git 2.31.1:\n>> $ . /usr/lib/git-core/git-sh-prompt\n>> $ PS1='[\\u@\\h \\W$(__git_ps1 \" (%s)\")]\\$ '\n>> $ cd someGitRepo\n>> bash: GIT_PS1_COMPRESSSPARSESTATE: unbound variable\n>> $ \n>\n> Would\n>\n>     $ set +u\n>\n> fix it, I have to wonder?\n\nAssuming that the answer is yes,...\n\nI do not know who maintains this contrib/ script, but here is what\n\n$ git grep -e '\\$GIT_PS1_' -e '\\${GIT_PS1_[^}-]*}' contrib/completion\n\ngave me a handful candidates for fixes.  Randomly picking Elijah from\nthe output of\n\n    $ git shortlog --no-merges -sn --since=18.months  \\\n\tcontrib/completion/git-prompt.sh |\n      head -n 1\n\nfor ideas.\n\nThanks.\n\n contrib/completion/git-prompt.sh | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git i/contrib/completion/git-prompt.sh w/contrib/completion/git-prompt.sh\nindex 4640a1535d..b9485f4016 100644\n--- i/contrib/completion/git-prompt.sh\n+++ w/contrib/completion/git-prompt.sh\n@@ -139,7 +139,7 @@ __git_ps1_show_upstream ()\n \n \t# parse configuration values\n \tlocal option\n-\tfor option in ${GIT_PS1_SHOWUPSTREAM}; do\n+\tfor option in ${GIT_PS1_SHOWUPSTREAM-}; do\n \t\tcase \"$option\" in\n \t\tgit|svn) upstream=\"$option\" ;;\n \t\tverbose) verbose=1 ;;\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"},{"id":"424417","messageId":"CABPp-BGERNLKbLA_r7i7+r+v7YK6xT00_5n9ebESb2SzLhC0Cg@mail.gmail.com","threadId":"55678","inReplyTo":"xmqqzgwzb7ad.fsf@gitster.g","subject":"Re: git-sh-prompt: bash: GIT_PS1_COMPRESSSPARSESTATE: unbound variable","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2021-05-13T04:53:20Z","receivedAt":"2021-05-13T04:53:36Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Wed, May 12, 2021 at 9:13 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n> > Christoph Anton Mitterer <calestyo@scientia.net> writes:\n> >\n> >> Could it be that git-sh-prompt no longer works properly?\n> >>\n> >> With git 2.31.1:\n> >> $ . /usr/lib/git-core/git-sh-prompt\n> >> $ PS1='[\\u@\\h \\W$(__git_ps1 \" (%s)\")]\\$ '\n> >> $ cd someGitRepo\n> >> bash: GIT_PS1_COMPRESSSPARSESTATE: unbound variable\n> >> $\n> >\n> > Would\n> >\n> >     $ set +u\n> >\n> > fix it, I have to wonder?\n>\n> Assuming that the answer is yes,...\n>\n> I do not know who maintains this contrib/ script, but here is what\n>\n> $ git grep -e '\\$GIT_PS1_' -e '\\${GIT_PS1_[^}-]*}' contrib/completion\n>\n> gave me a handful candidates for fixes.  Randomly picking Elijah from\n> the output of\n>\n>     $ git shortlog --no-merges -sn --since=18.months  \\\n>         contrib/completion/git-prompt.sh |\n>       head -n 1\n>\n> for ideas.\n\nYeah, I accidentally was relying on undefined-translates-to-empty,\nwhich breaks under set -u.  I can duplicate the precise error, and\nyour fix below is exactly how I fixed it too, before seeing you posted\nthe same fix.\n\nI'll post a patch with you as author...and some questions on what to\ndo with the rest of the commit message and attribution tags.\n\n> Thanks.\n>\n>  contrib/completion/git-prompt.sh | 8 ++++----\n>  1 file changed, 4 insertions(+), 4 deletions(-)\n>\n> diff --git i/contrib/completion/git-prompt.sh w/contrib/completion/git-prompt.sh\n> index 4640a1535d..b9485f4016 100644\n> --- i/contrib/completion/git-prompt.sh\n> +++ w/contrib/completion/git-prompt.sh\n> @@ -139,7 +139,7 @@ __git_ps1_show_upstream ()\n>\n>         # parse configuration values\n>         local option\n> -       for option in ${GIT_PS1_SHOWUPSTREAM}; do\n> +       for option in ${GIT_PS1_SHOWUPSTREAM-}; do\n>                 case \"$option\" in\n>                 git|svn) upstream=\"$option\" ;;\n>                 verbose) verbose=1 ;;\n> @@ -433,8 +433,8 @@ __git_ps1 ()\n>         fi\n>\n>         local sparse=\"\"\n> -       if [ -z \"${GIT_PS1_COMPRESSSPARSESTATE}\" ] &&\n> -          [ -z \"${GIT_PS1_OMITSPARSESTATE}\" ] &&\n> +       if [ -z \"${GIT_PS1_COMPRESSSPARSESTATE-}\" ] &&\n> +          [ -z \"${GIT_PS1_OMITSPARSESTATE-}\" ] &&\n>            [ \"$(git config --bool core.sparseCheckout)\" = \"true\" ]; then\n>                 sparse=\"|SPARSE\"\n>         fi\n> @@ -543,7 +543,7 @@ __git_ps1 ()\n>                         u=\"%${ZSH_VERSION+%}\"\n>                 fi\n>\n> -               if [ -n \"${GIT_PS1_COMPRESSSPARSESTATE}\" ] &&\n> +               if [ -n \"${GIT_PS1_COMPRESSSPARSESTATE-}\" ] &&\n>                    [ \"$(git config --bool core.sparseCheckout)\" = \"true\" ]; then\n>                         h=\"?\"\n>                 fi\n"},{"id":"424418","messageId":"xmqqv97nb51b.fsf@gitster.g","threadId":"55678","inReplyTo":"CABPp-BGERNLKbLA_r7i7+r+v7YK6xT00_5n9ebESb2SzLhC0Cg@mail.gmail.com","subject":"Re: git-sh-prompt: bash: GIT_PS1_COMPRESSSPARSESTATE: unbound variable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-05-13T05:01:52Z","receivedAt":"2021-05-13T05:02:03Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Elijah Newren <newren@gmail.com> writes:\n\n> Yeah, I accidentally was relying on undefined-translates-to-empty,\n> which breaks under set -u.  I can duplicate the precise error, and\n> your fix below is exactly how I fixed it too, before seeing you posted\n> the same fix.\n>\n> I'll post a patch with you as author...and some questions on what to\n> do with the rest of the commit message and attribution tags.\n\nNah, please take full credit for it.  It is more work to test the\nresult of the change than just running a grep and coming up with \"I\nwonder if this would work...\".\n\nThanks for a sanity check.\n\n>\n>> Thanks.\n>>\n>>  contrib/completion/git-prompt.sh | 8 ++++----\n>>  1 file changed, 4 insertions(+), 4 deletions(-)\n>>\n>> diff --git i/contrib/completion/git-prompt.sh w/contrib/completion/git-prompt.sh\n>> index 4640a1535d..b9485f4016 100644\n>> --- i/contrib/completion/git-prompt.sh\n>> +++ w/contrib/completion/git-prompt.sh\n>> @@ -139,7 +139,7 @@ __git_ps1_show_upstream ()\n>>\n>>         # parse configuration values\n>>         local option\n>> -       for option in ${GIT_PS1_SHOWUPSTREAM}; do\n>> +       for option in ${GIT_PS1_SHOWUPSTREAM-}; do\n>>                 case \"$option\" in\n>>                 git|svn) upstream=\"$option\" ;;\n>>                 verbose) verbose=1 ;;\n>> @@ -433,8 +433,8 @@ __git_ps1 ()\n>>         fi\n>>\n>>         local sparse=\"\"\n>> -       if [ -z \"${GIT_PS1_COMPRESSSPARSESTATE}\" ] &&\n>> -          [ -z \"${GIT_PS1_OMITSPARSESTATE}\" ] &&\n>> +       if [ -z \"${GIT_PS1_COMPRESSSPARSESTATE-}\" ] &&\n>> +          [ -z \"${GIT_PS1_OMITSPARSESTATE-}\" ] &&\n>>            [ \"$(git config --bool core.sparseCheckout)\" = \"true\" ]; then\n>>                 sparse=\"|SPARSE\"\n>>         fi\n>> @@ -543,7 +543,7 @@ __git_ps1 ()\n>>                         u=\"%${ZSH_VERSION+%}\"\n>>                 fi\n>>\n>> -               if [ -n \"${GIT_PS1_COMPRESSSPARSESTATE}\" ] &&\n>> +               if [ -n \"${GIT_PS1_COMPRESSSPARSESTATE-}\" ] &&\n>>                    [ \"$(git config --bool core.sparseCheckout)\" = \"true\" ]; then\n>>                         h=\"?\"\n>>                 fi\n"},{"id":"424468","messageId":"123ef9e4f5dfe64e62dbdb207633df06cd94e818.camel@scientia.net","threadId":"55678","inReplyTo":"xmqq4kf7cmaj.fsf@gitster.g","subject":"Re: git-sh-prompt: bash: GIT_PS1_COMPRESSSPARSESTATE: unbound variable","fromName":"Christoph Anton Mitterer","fromEmail":"calestyo@scientia.net","sentAt":"2021-05-13T13:08:16Z","receivedAt":"2021-05-13T13:08:40Z","isPatch":false,"sender":{"key":"calestyo@scientia.net","avatar":"https://gravatar.com/avatar/74cd78048081efac1fcd21e681751ed55968f949a50e33adbe1a41c572a605cd?d=mp&s=160"},"body":"On Thu, 2021-05-13 at 13:03 +0900, Junio C Hamano wrote:\n> Would\n>     $ set +u\n> fix it, I have to wonder?\n\nDamn, I'm so blind ^^ Had recently set -u to try out whether unset\nvariables are used anywhere.\nYes it fixes it.\n\nThanks anyway for going to fix it :-)\n\n\nCheers,\nChris.\n\n"},{"id":"424976","messageId":"681aefe15af98f6758f28544b96bc2eca90642f3.camel@scientia.net","threadId":"55678","inReplyTo":"xmqqv97nb51b.fsf@gitster.g","subject":"Re: git-sh-prompt: bash: GIT_PS1_COMPRESSSPARSESTATE: unbound variable","fromName":"Christoph Anton Mitterer","fromEmail":"calestyo@scientia.net","sentAt":"2021-05-19T17:56:53Z","receivedAt":"2021-05-19T17:57:00Z","isPatch":false,"sender":{"key":"calestyo@scientia.net","avatar":"https://gravatar.com/avatar/74cd78048081efac1fcd21e681751ed55968f949a50e33adbe1a41c572a605cd?d=mp&s=160"},"body":"Hey there.\n\nI think I found another case of an unbound variable:\n\nCompleting e.g.:\ngit commit --[press TAB]\n\ngives:\n$ git commit  --bash: GIT_COMPLETION_SHOW_ALL: unbound variable\n\n\nwith some debugging:\n$ set -xv\n$ git commit --+ __git_func_wrap __git_main\n+ local cur words cword prev\n+ _get_comp_words_by_ref -n =: cur words cword prev\n+ local exclude flag i OPTIND=1\n+ words=()\n+ local cur cword words\n+ upargs=()\n+ upvars=()\n+ local upargs upvars vcur vcword vprev vwords\n+ getopts c:i:n:p:w: flag -n =: cur words cword prev\n+ case $flag in\n+ exclude==:\n+ getopts c:i:n:p:w: flag -n =: cur words cword prev\n+ [[ 6 -ge 3 ]]\n+ case ${!OPTIND} in\n+ vcur=cur\n+ (( OPTIND += 1 ))\n+ [[ 6 -ge 4 ]]\n+ case ${!OPTIND} in\n+ vwords=words\n+ (( OPTIND += 1 ))\n+ [[ 6 -ge 5 ]]\n+ case ${!OPTIND} in\n+ vcword=cword\n+ (( OPTIND += 1 ))\n+ [[ 6 -ge 6 ]]\n+ case ${!OPTIND} in\n+ vprev=prev\n+ (( OPTIND += 1 ))\n+ [[ 6 -ge 7 ]]\n+ __get_cword_at_cursor_by_ref =: words cword cur\n+ words=()\n+ local cword words\n+ __reassemble_comp_words_by_ref =: words cword\n+ local exclude i j line ref\n+ [[ -n =: ]]\n+ exclude='[=:]'\n+ printf -v cword %s 2\n+ [[ -v exclude ]]\n+ line='git commit --'\n+ (( i = 0, j = 0 ))\n+ (( i < 3 ))\n+ [[ 0 -gt 0 ]]\n+ ref='words[0]'\n+ printf -v 'words[0]' %s git\n+ line=' commit --'\n+ (( i == COMP_CWORD ))\n+ (( i++, j++ ))\n+ (( i < 3 ))\n+ [[ 1 -gt 0 ]]\n+ [[ commit == +([=:]) ]]\n+ ref='words[1]'\n+ printf -v 'words[1]' %s commit\n+ line=' --'\n+ (( i == COMP_CWORD ))\n+ (( i++, j++ ))\n+ (( i < 3 ))\n+ [[ 2 -gt 0 ]]\n+ [[ -- == +([=:]) ]]\n+ ref='words[2]'\n+ printf -v 'words[2]' %s --\n+ line=\n+ (( i == COMP_CWORD ))\n+ printf -v cword %s 2\n+ (( i++, j++ ))\n+ (( i < 3 ))\n+ (( i == COMP_CWORD ))\n+ local i cur= index=13 'lead=git commit --'\n+ [[ 13 -gt 0 ]]\n+ [[ -n git commit -- ]]\n+ [[ -n gitcommit-- ]]\n+ cur='git commit --'\n+ (( i = 0 ))\n+ (( i <= cword ))\n+ [[ 13 -ge 3 ]]\n+ [[ git != \\g\\i\\t ]]\n+ (( i < cword ))\n+ local old_size=13\n+ cur=' commit --'\n+ local new_size=10\n+ (( index -= old_size - new_size ))\n+ (( ++i ))\n+ (( i <= cword ))\n+ [[ 10 -ge 6 ]]\n+ [[  commi != \\c\\o\\m\\m\\i\\t ]]\n+ cur='commit --'\n+ (( index > 0 ))\n+ (( index-- ))\n+ [[ 9 -ge 6 ]]\n+ [[ commit != \\c\\o\\m\\m\\i\\t ]]\n+ (( i < cword ))\n+ local old_size=9\n+ cur=' --'\n+ local new_size=3\n+ (( index -= old_size - new_size ))\n+ (( ++i ))\n+ (( i <= cword ))\n+ [[ 3 -ge 2 ]]\n+ [[  - != \\-\\- ]]\n+ cur=--\n+ (( index > 0 ))\n+ (( index-- ))\n+ [[ 2 -ge 2 ]]\n+ [[ -- != \\-\\- ]]\n+ (( i < cword ))\n+ (( ++i ))\n+ (( i <= cword ))\n+ [[ -n -- ]]\n+ [[ ! -n -- ]]\n+ (( index < 0 ))\n+ local words cword cur\n+ _upvars -a3 words git commit -- -v cword 2 -v cur --\n+ (( 11 ))\n+ (( 11 ))\n+ case $1 in\n+ [[ -n 3 ]]\n+ printf %d 3\n+ [[ -n words ]]\n+ unset -v words\n+ eval 'words=(\"${@:3:3}\")'\nwords=(\"${@:3:3}\")\n++ words=(\"${@:3:3}\")\n+ shift 5\n+ (( 6 ))\n+ case $1 in\n+ [[ -n cword ]]\n+ unset -v cword\n+ eval 'cword=\"$3\"'\ncword=\"$3\"\n++ cword=2\n+ shift 3\n+ (( 3 ))\n+ case $1 in\n+ [[ -n cur ]]\n+ unset -v cur\n+ eval 'cur=\"$3\"'\ncur=\"$3\"\n++ cur=--\n+ shift 3\n+ (( 0 ))\n+ [[ -v vcur ]]\n+ upvars+=(\"$vcur\")\n+ upargs+=(-v $vcur \"$cur\")\n+ [[ -v vcword ]]\n+ upvars+=(\"$vcword\")\n+ upargs+=(-v $vcword \"$cword\")\n+ [[ -v vprev ]]\n+ [[ 2 -ge 1 ]]\n+ upvars+=(\"$vprev\")\n+ upargs+=(-v $vprev \"${words[cword - 1]}\")\n+ [[ -v vwords ]]\n+ upvars+=(\"$vwords\")\n+ upargs+=(-a${#words[@]} $vwords ${words+\"${words[@]}\"})\n+ (( 4 ))\n+ local cur cword prev words\n+ _upvars -v cur -- -v cword 2 -v prev commit -a3 words git commit --\n+ (( 14 ))\n+ (( 14 ))\n+ case $1 in\n+ [[ -n cur ]]\n+ unset -v cur\n+ eval 'cur=\"$3\"'\ncur=\"$3\"\n++ cur=--\n+ shift 3\n+ (( 11 ))\n+ case $1 in\n+ [[ -n cword ]]\n+ unset -v cword\n+ eval 'cword=\"$3\"'\ncword=\"$3\"\n++ cword=2\n+ shift 3\n+ (( 8 ))\n+ case $1 in\n+ [[ -n prev ]]\n+ unset -v prev\n+ eval 'prev=\"$3\"'\nprev=\"$3\"\n++ prev=commit\n+ shift 3\n+ (( 5 ))\n+ case $1 in\n+ [[ -n 3 ]]\n+ printf %d 3\n+ [[ -n words ]]\n+ unset -v words\n+ eval 'words=(\"${@:3:3}\")'\nwords=(\"${@:3:3}\")\n++ words=(\"${@:3:3}\")\n+ shift 5\n+ (( 0 ))\n+ __git_main\n+ local i c=1 command __git_dir __git_repo_path\n+ local __git_C_args C_args_count=0\n+ '[' 1 -lt 2 ']'\n+ i=commit\n+ case \"$i\" in\n+ command=commit\n+ break\n+ '[' -z commit ']'\n+ __git_complete_command commit\n+ local command=commit\n+ local completion_func=_git_commit\n+ __git_have_func _git_commit\n+ declare -f -- _git_commit\n+ __git_have_func _git_commit\n+ declare -f -- _git_commit\n+ _git_commit\n+ case \"$prev\" in\n+ case \"$cur\" in\n+ __gitcomp_builtin commit\n+ local cmd=commit\n+ local incl=\n+ local excl=\n+ local var=__gitcomp_builtin_commit\n+ local options\n+ eval 'options=${__gitcomp_builtin_commit-}'\noptions=${__gitcomp_builtin_commit-}\n++ options=\n+ '[' -z '' ']'\n+ local completion_helper\nbash: GIT_COMPLETION_SHOW_ALL: unbound variable\n\nThese seem to be in: \n/usr/share/bash-completion/completions/git\nand possibly also:\n/usr/share/bash-completion/completions/gitk\n\n\nCheers,\nChris.\n\n"},{"id":"425001","messageId":"xmqqr1i2wbef.fsf@gitster.g","threadId":"55678","inReplyTo":"681aefe15af98f6758f28544b96bc2eca90642f3.camel@scientia.net","subject":"Re: git-sh-prompt: bash: GIT_PS1_COMPRESSSPARSESTATE: unbound variable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-05-19T23:29:12Z","receivedAt":"2021-05-19T23:29:15Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Christoph Anton Mitterer <calestyo@scientia.net> writes:\n\n> Hey there.\n>\n> I think I found another case of an unbound variable:\n>\n> Completing e.g.:\n> git commit --[press TAB]\n>\n> gives:\n> $ git commit  --bash: GIT_COMPLETION_SHOW_ALL: unbound variable\n\nIt seems that OMIT_SPARSESTATE would have the same issue.\n\n\tif [ -z \"${GIT_PS1_COMPRESSSPARSESTATE}\" ] &&\n\t   [ -z \"${GIT_PS1_OMITSPARSESTATE}\" ] &&\n\nall coming from afda36db (git-prompt: include sparsity state as\nwell, 2020-06-21).\n\nBut I think we have already seen the fix in 5c0cbdb1 (git-prompt:\nwork under set -u, 2021-05-13), which may or may not appear in the\nupcoming release.\n\nThere still are unprotected mentions of GIT_PS1_SHOWUPSTREAM even\nwith that fix, though.\n"},{"id":"425004","messageId":"CABPp-BFY41YrO1cVNxGJG2rSXb=Y0EY3t7Y9x+ENAKmA0=oreA@mail.gmail.com","threadId":"55678","inReplyTo":"xmqqr1i2wbef.fsf@gitster.g","subject":"Re: git-sh-prompt: bash: GIT_PS1_COMPRESSSPARSESTATE: unbound variable","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2021-05-20T00:09:40Z","receivedAt":"2021-05-20T00:09:54Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Wed, May 19, 2021 at 4:29 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Christoph Anton Mitterer <calestyo@scientia.net> writes:\n>\n> > Hey there.\n> >\n> > I think I found another case of an unbound variable:\n> >\n> > Completing e.g.:\n> > git commit --[press TAB]\n> >\n> > gives:\n> > $ git commit  --bash: GIT_COMPLETION_SHOW_ALL: unbound variable\n\nThat particular case was fixed by Ville Skyttä in commit c5c0548d793e\n(completion: audit and guard $GIT_* against unset use, 2021-04-08).\n\n> It seems that OMIT_SPARSESTATE would have the same issue.\n>\n>         if [ -z \"${GIT_PS1_COMPRESSSPARSESTATE}\" ] &&\n>            [ -z \"${GIT_PS1_OMITSPARSESTATE}\" ] &&\n>\n> all coming from afda36db (git-prompt: include sparsity state as\n> well, 2020-06-21).\n>\n> But I think we have already seen the fix in 5c0cbdb1 (git-prompt:\n> work under set -u, 2021-05-13), which may or may not appear in the\n> upcoming release.\n\nYeah, I fixed the ones I introduced in git-prompt.sh --\nGIT_PS1_COMPRESSSPARSESTATE and GIT_PS1_OMITSPARSESTATE.\n\n> There still are unprotected mentions of GIT_PS1_SHOWUPSTREAM even\n> with that fix, though.\n\nYeah, neither my fix (which was only trying to fix the problems I\nintroduced in git-prompt.sh) nor Ville's fix (which was focused on\ngit-completion.bash) caught that one.\n\nDo you want to make a patch for that, Christoph?  If not, #leftoverbits?\n"}]}