git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "David J. Malan via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Elijah Newren <newren@gmail.com>,
	Junio C Hamano <gitster@pobox.com>,
	"David J. Malan" <malan@harvard.edu>,
	"David J. Malan" <malan@harvard.edu>
Subject: [PATCH v2] git-prompt: change == to = for zsh's sake
Date: Tue, 21 Jul 2020 00:15:31 +0000	[thread overview]
Message-ID: <pull.679.v2.git.1595290531264.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.679.git.1595287052428.gitgitgadget@gmail.com>

From: "David J. Malan" <malan@harvard.edu>

When using git-prompt.sh with zsh, __git_ps1 currently errs
when inside a repo with:

__git_ps1:96: = not found

Avoid using non-portable "==" that is only understood by bash
and not zsh. Change to "=" so that the prompt script becomes
usable with zsh again.

Signed-off-by: David J. Malan <malan@harvard.edu>
---
    Change == 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.
    
    Changes since v1:
    
     * Commit message rewritten to use imperative mood.
     * Commit message rewritten to elaborate on reason for change.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-679%2Fdmalan%2Fpatch-1-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-679/dmalan/patch-1-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/679

Range-diff vs v1:

 1:  95be513ed1 ! 1:  f5402f1512 git-prompt: changes == to = for zsh's sake
     @@ Metadata
      Author: David J. Malan <malan@harvard.edu>
      
       ## Commit message ##
     -    git-prompt: changes == to = for zsh's sake
     +    git-prompt: change == to = for zsh's sake
      
     -    When using git-prompt.sh with Zsh, __git_ps1 currently errs
     +    When using git-prompt.sh with zsh, __git_ps1 currently errs
          when inside a repo with:
      
          __git_ps1:96: = not found
      
     -    This commit changes `==` to `=` for both Bash and Zsh.
     +    Avoid using non-portable "==" that is only understood by bash
     +    and not zsh. Change to "=" so that the prompt script becomes
     +    usable with zsh again.
      
          Signed-off-by: David J. Malan <malan@harvard.edu>
      


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

  parent reply	other threads:[~2020-07-21  0:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-20 23:17 [PATCH] git-prompt: changes == to = for zsh's sake David J. Malan via GitGitGadget
2020-07-20 23:58 ` Junio C Hamano
2020-07-21  0:40   ` Elijah Newren
2020-07-21  0:15 ` David J. Malan via GitGitGadget [this message]
2020-07-21  0:23 ` Aaron Schrab
2020-07-21  0:40   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.679.v2.git.1595290531264.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=malan@harvard.edu \
    --cc=newren@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).