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

Re: [PATCH] git-prompt: changes == to = for zsh's sake

From
Elijah Newren <newren@gmail.com>
Date
Jul 21, 2020, 00:40 UTC
Message-ID
<CABPp-BGm4UuRsL0K5=rAxyXaQYTgWicmFKNcRRfJziQ7BmSP1g@mail.gmail.com>
In-Reply-To
<xmqqpn8p91sy.fsf@gitster.c.googlers.com>
On Mon, Jul 20, 2020 at 4:58 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 29 quoted lines
>
> "David J. Malan via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > From: "David J. Malan" <malan@harvard.edu>
> > Subject: Re: [PATCH] git-prompt: changes == to = for zsh's sake
>
> s/changes/change/
>
> > When using git-prompt.sh with Zsh, __git_ps1 currently errs
> > when inside a repo with:
> >
> > __git_ps1:96: = not found
>
> OK.
>
> > This commit changes `==` to `=` for both Bash and Zsh.
>
> We prefer to see "why" instead of "what", as the latter can easily
> be read from the patch text.
>
>     Avoid using non-portable "==" that is only understood by bash
>     and not zsh to "="; that way the prompt script becomes usable
>     with zsh again.
>
> or something like that.
>
> Elijah, I think this is a minor regression in this cycle, and the
> fix is obvious enough that it deserves to be in the upcoming
> release.  Agreed?

Yeah, it's a pretty obvious and very localized fix for a regression from this cycle. I'd say putting it in the upcoming release makes sense.

> Thank you, David, for a fix.
+1.
Show 46 quoted lines
> > Signed-off-by: David J. Malan <malan@harvard.edu>
> > ---
> >     Changes == to = for zsh's sake in git-prompt.sh
> >
> >     Upon installing git-prompt.sh
> >     [https://github.com/gitgitgadget/git/blob/master/contrib/completion/git-prompt.sh]
> >     on macOS Catalina, I noticed that
> >     https://github.com/gitgitgadget/git/commit/afda36dbf3b4f5a489ab44c00d5210c1fa894a40
> >     seems to have introduced an issue for Zsh whereby __git_ps1 errs with
> >
> >     __git_ps1:96: = not found
> >
> >     when inside a repo. Changing == to = would seem to address for both Bash
> >     and Zsh.
> >
> > Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-679%2Fdmalan%2Fpatch-1-v1
> > Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-679/dmalan/patch-1-v1
> > Pull-Request: https://github.com/gitgitgadget/git/pull/679
> >
> >  contrib/completion/git-prompt.sh | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
> > index e6cd5464e5..16260bab73 100644
> > --- a/contrib/completion/git-prompt.sh
> > +++ b/contrib/completion/git-prompt.sh
> > @@ -433,7 +433,7 @@ __git_ps1 ()
> >       local sparse=""
> >       if [ -z "${GIT_PS1_COMPRESSSPARSESTATE}" ] &&
> >          [ -z "${GIT_PS1_OMITSPARSESTATE}" ] &&
> > -        [ "$(git config --bool core.sparseCheckout)" == "true" ]; then
> > +        [ "$(git config --bool core.sparseCheckout)" = "true" ]; then
> >               sparse="|SPARSE"
> >       fi
> >
> > @@ -542,7 +542,7 @@ __git_ps1 ()
> >               fi
> >
> >               if [ -n "${GIT_PS1_COMPRESSSPARSESTATE}" ] &&
> > -                [ "$(git config --bool core.sparseCheckout)" == "true" ]; then
> > +                [ "$(git config --bool core.sparseCheckout)" = "true" ]; then
> >                       h="?"
> >               fi
> >
> >
> > base-commit: ae46588be0cd730430dded4491246dfb4eac5557
Previous: Junio C HamanoNext: David J. Malan via GitGitGadget
Message 3 of 6 in “git-prompt: changes == to = for zsh's sake”
  1. git-prompt: changes == to = for zsh's sakeDavid J. Malan via GitGitGadget, Jul 20, 2020
  2. Junio C HamanoJul 20, 2020
  3. Elijah NewrenJul 21, 2020
  4. git-prompt: change == to = for zsh's sakeDavid J. Malan via GitGitGadget, Jul 21, 2020
  5. Aaron SchrabJul 21, 2020
  6. Junio C HamanoJul 21, 2020

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.