git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] prompt: fix tracked files for zsh
Date: Sun, 21 Apr 2013 01:43:14 -0700	[thread overview]
Message-ID: <7vppxouvdp.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1366531890-19899-1-git-send-email-felipe.contreras@gmail.com> (Felipe Contreras's message of "Sun, 21 Apr 2013 03:11:30 -0500")

Felipe Contreras <felipe.contreras@gmail.com> writes:

> When this option is enabled, the prompt gets totally screwed in zsh
> because all the codes start with % in zsh (like they are \ in bas). So
> we need to escape the % character.

It is not that I do not believe that $u needs to duplicate %% in
ZSH, but I hate it when I do not understand the explanation.  Could
you help me clarify what you meant by "codes" and "like they are \ in bas"?

Are you referring to things like \u (user) \h (host) as "code" and
"bas" was a simple typo of "bash"?  In other words, does my reading
below:

	... because '%' is used as an introducer of prompt
	customization in zsh (just like bash prompt uses '\' to
	introduce \u, \h, etc.), we need to give '%%' to get a
	literal per-cent character.

match what you meant to say?

> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  contrib/completion/git-prompt.sh | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
> index 756a951..4bedbcc 100644
> --- a/contrib/completion/git-prompt.sh
> +++ b/contrib/completion/git-prompt.sh
> @@ -340,7 +340,11 @@ __git_ps1 ()
>  			   [ "$(git config --bool bash.showUntrackedFiles)" != "false" ] &&
>  			   [ -n "$(git ls-files --others --exclude-standard)" ]
>  			then
> -				u="%"
> +				if [ -n "${ZSH_VERSION-}" ]; then
> +					u="%%"
> +				else
> +					u="%"
> +				fi
>  			fi
>  
>  			if [ -n "${GIT_PS1_SHOWUPSTREAM-}" ]; then

      parent reply	other threads:[~2013-04-21  8:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-21  8:11 [PATCH] prompt: fix tracked files for zsh Felipe Contreras
2013-04-21  8:21 ` Andreas Schwab
2013-04-21  8:48   ` Junio C Hamano
2013-04-21 19:02     ` Andreas Schwab
2013-04-21 21:00       ` Felipe Contreras
2013-04-21 22:00         ` Junio C Hamano
2013-04-21 22:32           ` Felipe Contreras
2013-04-21  8:43 ` Junio C Hamano
2013-04-21  8:43 ` Eric Sunshine
2013-04-21  8:43 ` Junio C Hamano [this message]

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

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

  git send-email \
    --in-reply-to=7vppxouvdp.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
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 NNTP newsgroup(s).