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

RE: BUG: git prompt breaks with zsh < 5.0.6

From
SVShupak, Vitaly <vitaly.shupak@deshaw.com>
Date
Jan 10, 2023, 15:15 UTC
Message-ID
<f1610b3f00284e69a089d40c7182a8ab@deshaw.com>
In-Reply-To
<Y7ylHW8nrsT1eVtW@tapette.crustytoothpaste.net>
Yes, that works too
-----Original Message-----
From: brian m. carlson <sandals@crustytoothpaste.net> 
Sent: Monday, January 9, 2023 6:37 PM
To: Shupak, Vitaly <Vitaly.Shupak@deshaw.com>
Cc: git@vger.kernel.org
Subject: Re: BUG: git prompt breaks with zsh < 5.0.6
On 2023-01-09 at 17:12:56, Shupak, Vitaly wrote:
Show 11 quoted lines
> A change to git-prompt.sh in v2.38 to show presence of unresolved conflicts contains syntax which is not valid under zsh < 5.0.6. This version of zsh is old, but is still the default on RedHat 7 machines, for example.
> 
> The offending block is:
> 
>        local conflict="" # state indicator for unresolved conflicts
>        if [[ "${GIT_PS1_SHOWCONFLICTSTATE}" == "yes" ]] &&
>           [[ $(git ls-files --unmerged 2>/dev/null) ]]; then
>                conflict="|CONFLICT"
>        fi
> 
> [[ $(command) ]] syntax doesn't work in older version of zsh and should use [[ -n "$(command)" ]] instead.

Does [ "$(command)" ] work? I would assume so, because that's in POSIX. If so, that might also be a valid approach since it doesn't look like we need the special behaviour of the double-bracket operator. -- brian m. carlson (he/him or they/them) Toronto, Ontario, CA

Previous: brian m. carlson
Message 3 of 3 in “BUG: git prompt breaks with zsh < 5.0.6”
  1. Shupak, VitalyJan 9, 2023
  2. brian m. carlsonJan 9, 2023
  3. Shupak, VitalyJan 10, 2023

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.