git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* BUG: git prompt breaks with zsh < 5.0.6
@ 2023-01-09 17:12 Shupak, Vitaly
  2023-01-09 23:37 ` brian m. carlson
  0 siblings, 1 reply; 3+ messages in thread
From: Shupak, Vitaly @ 2023-01-09 17:12 UTC (permalink / raw)
  To: git@vger.kernel.org

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.

Thanks,
Vitaly


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: BUG: git prompt breaks with zsh < 5.0.6
  2023-01-09 17:12 BUG: git prompt breaks with zsh < 5.0.6 Shupak, Vitaly
@ 2023-01-09 23:37 ` brian m. carlson
  2023-01-10 15:15   ` Shupak, Vitaly
  0 siblings, 1 reply; 3+ messages in thread
From: brian m. carlson @ 2023-01-09 23:37 UTC (permalink / raw)
  To: Shupak, Vitaly; +Cc: git@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 946 bytes --]

On 2023-01-09 at 17:12:56, Shupak, Vitaly wrote:
> 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: BUG: git prompt breaks with zsh < 5.0.6
  2023-01-09 23:37 ` brian m. carlson
@ 2023-01-10 15:15   ` Shupak, Vitaly
  0 siblings, 0 replies; 3+ messages in thread
From: Shupak, Vitaly @ 2023-01-10 15:15 UTC (permalink / raw)
  To: brian m. carlson; +Cc: git@vger.kernel.org

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:
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-10 15:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-09 17:12 BUG: git prompt breaks with zsh < 5.0.6 Shupak, Vitaly
2023-01-09 23:37 ` brian m. carlson
2023-01-10 15:15   ` Shupak, Vitaly

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).