Re: git-sh-prompt: bash: GIT_PS1_COMPRESSSPARSESTATE: unbound variable

2 messages, 2 authors, 2021-05-20 · open the first message on its own page

Re: git-sh-prompt: bash: GIT_PS1_COMPRESSSPARSESTATE: unbound variable

From: Junio C Hamano <hidden>
Date: 2021-05-19 23:29:15

Christoph Anton Mitterer [off-list ref] writes:
Hey there.

I think I found another case of an unbound variable:

Completing e.g.:
git commit --[press TAB]

gives:
$ git commit  --bash: GIT_COMPLETION_SHOW_ALL: unbound variable
It seems that OMIT_SPARSESTATE would have the same issue.

	if [ -z "${GIT_PS1_COMPRESSSPARSESTATE}" ] &&
	   [ -z "${GIT_PS1_OMITSPARSESTATE}" ] &&

all coming from afda36db (git-prompt: include sparsity state as
well, 2020-06-21).

But I think we have already seen the fix in 5c0cbdb1 (git-prompt:
work under set -u, 2021-05-13), which may or may not appear in the
upcoming release.

There still are unprotected mentions of GIT_PS1_SHOWUPSTREAM even
with that fix, though.

Re: git-sh-prompt: bash: GIT_PS1_COMPRESSSPARSESTATE: unbound variable

From: Elijah Newren <hidden>
Date: 2021-05-20 00:09:54

On Wed, May 19, 2021 at 4:29 PM Junio C Hamano [off-list ref] wrote:
Christoph Anton Mitterer [off-list ref] writes:
quoted
Hey there.

I think I found another case of an unbound variable:

Completing e.g.:
git commit --[press TAB]

gives:
$ git commit  --bash: GIT_COMPLETION_SHOW_ALL: unbound variable
That particular case was fixed by Ville Skyttä in commit c5c0548d793e
(completion: audit and guard $GIT_* against unset use, 2021-04-08).
It seems that OMIT_SPARSESTATE would have the same issue.

        if [ -z "${GIT_PS1_COMPRESSSPARSESTATE}" ] &&
           [ -z "${GIT_PS1_OMITSPARSESTATE}" ] &&

all coming from afda36db (git-prompt: include sparsity state as
well, 2020-06-21).

But I think we have already seen the fix in 5c0cbdb1 (git-prompt:
work under set -u, 2021-05-13), which may or may not appear in the
upcoming release.
Yeah, I fixed the ones I introduced in git-prompt.sh --
GIT_PS1_COMPRESSSPARSESTATE and GIT_PS1_OMITSPARSESTATE.
There still are unprotected mentions of GIT_PS1_SHOWUPSTREAM even
with that fix, though.
Yeah, neither my fix (which was only trying to fix the problems I
introduced in git-prompt.sh) nor Ville's fix (which was focused on
git-completion.bash) caught that one.

Do you want to make a patch for that, Christoph?  If not, #leftoverbits?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help