git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Elijah Newren <newren@gmail.com>
Date
May 20, 2021, 00:09 UTC
Message-ID
<CABPp-BFY41YrO1cVNxGJG2rSXb=Y0EY3t7Y9x+ENAKmA0=oreA@mail.gmail.com>
In-Reply-To
<xmqqr1i2wbef.fsf@gitster.g>
On Wed, May 19, 2021 at 4:29 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 12 quoted lines
>
> Christoph Anton Mitterer <calestyo@scientia.net> 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

That particular case was fixed by Ville Skyttä in commit c5c0548d793e (completion: audit and guard $GIT_* against unset use, 2021-04-08).

Show 11 quoted lines
> 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?
Previous: Junio C HamanoNext: Christoph Anton Mitterer
Message 8 of 9 in “git-sh-prompt: bash: GIT_PS1_COMPRESSSPARSESTATE: unbound variable”
  1. Christoph Anton MittererMay 13, 2021
  2. Junio C HamanoMay 13, 2021
  3. Junio C HamanoMay 13, 2021
  4. Elijah NewrenMay 13, 2021
  5. Junio C HamanoMay 13, 2021
  6. Christoph Anton MittererMay 19, 2021
  7. Junio C HamanoMay 19, 2021
  8. Elijah NewrenMay 20, 2021
  9. Christoph Anton MittererMay 13, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.