{"thread":{"id":"59060","subject":"BUG: git prompt breaks with zsh < 5.0.6","startedAt":"2023-01-09T17:14:09Z","lastAt":"2023-01-10T15:15:33Z","messageCount":3,"participants":["Shupak, Vitaly","brian m. carlson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"469983","messageId":"5807cdbe6d66427c9ff45ea78c2c1ffb@deshaw.com","threadId":"59060","inReplyTo":null,"subject":"BUG: git prompt breaks with zsh < 5.0.6","fromName":"Shupak, Vitaly","fromEmail":"vitaly.shupak@deshaw.com","sentAt":"2023-01-09T17:12:56Z","receivedAt":"2023-01-09T17:14:09Z","isPatch":false,"sender":{"key":"vitaly.shupak@deshaw.com","avatar":null},"body":"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.\n\nThe offending block is:\n\n       local conflict=\"\" # state indicator for unresolved conflicts\n       if [[ \"${GIT_PS1_SHOWCONFLICTSTATE}\" == \"yes\" ]] &&\n          [[ $(git ls-files --unmerged 2>/dev/null) ]]; then\n               conflict=\"|CONFLICT\"\n       fi\n\n[[ $(command) ]] syntax doesn't work in older version of zsh and should use [[ -n \"$(command)\" ]] instead.\n\nThanks,\nVitaly\n\n"},{"id":"470016","messageId":"Y7ylHW8nrsT1eVtW@tapette.crustytoothpaste.net","threadId":"59060","inReplyTo":"5807cdbe6d66427c9ff45ea78c2c1ffb@deshaw.com","subject":"Re: BUG: git prompt breaks with zsh < 5.0.6","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2023-01-09T23:37:01Z","receivedAt":"2023-01-09T23:37:40Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2023-01-09 at 17:12:56, Shupak, Vitaly wrote:\n> 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.\n> \n> The offending block is:\n> \n>        local conflict=\"\" # state indicator for unresolved conflicts\n>        if [[ \"${GIT_PS1_SHOWCONFLICTSTATE}\" == \"yes\" ]] &&\n>           [[ $(git ls-files --unmerged 2>/dev/null) ]]; then\n>                conflict=\"|CONFLICT\"\n>        fi\n> \n> [[ $(command) ]] syntax doesn't work in older version of zsh and should use [[ -n \"$(command)\" ]] instead.\n\nDoes [ \"$(command)\" ] work?  I would assume so, because that's in POSIX.\nIf so, that might also be a valid approach since it doesn't look like we\nneed the special behaviour of the double-bracket operator.\n-- \nbrian m. carlson (he/him or they/them)\nToronto, Ontario, CA\n"},{"id":"470075","messageId":"f1610b3f00284e69a089d40c7182a8ab@deshaw.com","threadId":"59060","inReplyTo":"Y7ylHW8nrsT1eVtW@tapette.crustytoothpaste.net","subject":"RE: BUG: git prompt breaks with zsh < 5.0.6","fromName":"Shupak, Vitaly","fromEmail":"vitaly.shupak@deshaw.com","sentAt":"2023-01-10T15:15:26Z","receivedAt":"2023-01-10T15:15:33Z","isPatch":false,"sender":{"key":"vitaly.shupak@deshaw.com","avatar":null},"body":"Yes, that works too\n\n-----Original Message-----\nFrom: brian m. carlson <sandals@crustytoothpaste.net> \nSent: Monday, January 9, 2023 6:37 PM\nTo: Shupak, Vitaly <Vitaly.Shupak@deshaw.com>\nCc: git@vger.kernel.org\nSubject: Re: BUG: git prompt breaks with zsh < 5.0.6\n\nOn 2023-01-09 at 17:12:56, Shupak, Vitaly wrote:\n> 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.\n> \n> The offending block is:\n> \n>        local conflict=\"\" # state indicator for unresolved conflicts\n>        if [[ \"${GIT_PS1_SHOWCONFLICTSTATE}\" == \"yes\" ]] &&\n>           [[ $(git ls-files --unmerged 2>/dev/null) ]]; then\n>                conflict=\"|CONFLICT\"\n>        fi\n> \n> [[ $(command) ]] syntax doesn't work in older version of zsh and should use [[ -n \"$(command)\" ]] instead.\n\nDoes [ \"$(command)\" ] work?  I would assume so, because that's in POSIX.\nIf so, that might also be a valid approach since it doesn't look like we need the special behaviour of the double-bracket operator.\n--\nbrian m. carlson (he/him or they/them)\nToronto, Ontario, CA\n"}]}