{"thread":{"id":"33558","subject":"[PATCH] prompt: fix tracked files for zsh","startedAt":"2013-04-21T08:11:30Z","lastAt":"2013-04-21T22:32:29Z","messageCount":10,"participants":["Felipe Contreras","Andreas Schwab","Junio C Hamano","Eric Sunshine"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"214981","messageId":"1366531890-19899-1-git-send-email-felipe.contreras@gmail.com","threadId":"33558","inReplyTo":null,"subject":"[PATCH] prompt: fix tracked files for zsh","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-04-21T08:11:30Z","receivedAt":"2013-04-21T08:11:30Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"When this option is enabled, the prompt gets totally screwed in zsh\nbecause all the codes start with % in zsh (like they are \\ in bas). So\nwe need to escape the % character.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-prompt.sh | 6 +++++-\n 1 file changed, 5 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh\nindex 756a951..4bedbcc 100644\n--- a/contrib/completion/git-prompt.sh\n+++ b/contrib/completion/git-prompt.sh\n@@ -340,7 +340,11 @@ __git_ps1 ()\n \t\t\t   [ \"$(git config --bool bash.showUntrackedFiles)\" != \"false\" ] &&\n \t\t\t   [ -n \"$(git ls-files --others --exclude-standard)\" ]\n \t\t\tthen\n-\t\t\t\tu=\"%\"\n+\t\t\t\tif [ -n \"${ZSH_VERSION-}\" ]; then\n+\t\t\t\t\tu=\"%%\"\n+\t\t\t\telse\n+\t\t\t\t\tu=\"%\"\n+\t\t\t\tfi\n \t\t\tfi\n \n \t\t\tif [ -n \"${GIT_PS1_SHOWUPSTREAM-}\" ]; then\n-- \n1.8.2.1.790.g4588561\n"},{"id":"214986","messageId":"m2fvyk8fb8.fsf@igel.home","threadId":"33558","inReplyTo":"1366531890-19899-1-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH] prompt: fix tracked files for zsh","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2013-04-21T08:21:15Z","receivedAt":"2013-04-21T08:21:15Z","isPatch":true,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Felipe Contreras <felipe.contreras@gmail.com> writes:\n\n> +\t\t\t\tif [ -n \"${ZSH_VERSION-}\" ]; then\n> +\t\t\t\t\tu=\"%%\"\n> +\t\t\t\telse\n> +\t\t\t\t\tu=\"%\"\n> +\t\t\t\tfi\n\naka u=\"%${ZSH_VERSION:+%}\"\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"214989","messageId":"7vr4i4uvdy.fsf@alter.siamese.dyndns.org","threadId":"33558","inReplyTo":"1366531890-19899-1-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH] prompt: fix tracked files for zsh","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-04-21T08:43:05Z","receivedAt":"2013-04-21T08:43:05Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Felipe Contreras <felipe.contreras@gmail.com> writes:\n\n> When this option is enabled, the prompt gets totally screwed in zsh\n> because all the codes start with % in zsh (like they are \\ in bas). So\n> we need to escape the % character.\n\nIt is not that I do not believe that $u needs to duplicate %% in\nZSH, but I hate it when I do not understand the explanation.  Could\nyou help me clarify what you meant by \"codes\" and \"like they are \\ in bas\"?\n\nAre you referring to things like \\u (user) \\h (host) as \"code\" and\n\"bas\" was a simple typo of \"bash\"?  In other words, is my reading\nbelow:\n\n\t... because '%' is used as an introducer of prompt\n\tcustomization in zsh (just like bash prompt uses '\\' to\n\tintroduce \\u, \\h, etc.), we need to give '%%' to get a\n\tliteral per-cent character.\n\nmatch what you meant to say?\n\n> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> ---\n>  contrib/completion/git-prompt.sh | 6 +++++-\n>  1 file changed, 5 insertions(+), 1 deletion(-)\n>\n> diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh\n> index 756a951..4bedbcc 100644\n> --- a/contrib/completion/git-prompt.sh\n> +++ b/contrib/completion/git-prompt.sh\n> @@ -340,7 +340,11 @@ __git_ps1 ()\n>  \t\t\t   [ \"$(git config --bool bash.showUntrackedFiles)\" != \"false\" ] &&\n>  \t\t\t   [ -n \"$(git ls-files --others --exclude-standard)\" ]\n>  \t\t\tthen\n> -\t\t\t\tu=\"%\"\n> +\t\t\t\tif [ -n \"${ZSH_VERSION-}\" ]; then\n> +\t\t\t\t\tu=\"%%\"\n> +\t\t\t\telse\n> +\t\t\t\t\tu=\"%\"\n> +\t\t\t\tfi\n>  \t\t\tfi\n>  \n>  \t\t\tif [ -n \"${GIT_PS1_SHOWUPSTREAM-}\" ]; then\n"},{"id":"214990","messageId":"CAPig+cQqre7iW4DK+XSvFypng5sW=sK8os+ODz2kxYE8nkBw_Q@mail.gmail.com","threadId":"33558","inReplyTo":"1366531890-19899-1-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH] prompt: fix tracked files for zsh","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-04-21T08:43:05Z","receivedAt":"2013-04-21T08:43:05Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, Apr 21, 2013 at 4:11 AM, Felipe Contreras\n<felipe.contreras@gmail.com> wrote:\n> When this option is enabled, the prompt gets totally screwed in zsh\n> because all the codes start with % in zsh (like they are \\ in bas). So\n\ns/bas/bash/\n\n> we need to escape the % character.\n>\n> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n"},{"id":"214991","messageId":"7vppxouvdp.fsf@alter.siamese.dyndns.org","threadId":"33558","inReplyTo":"1366531890-19899-1-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH] prompt: fix tracked files for zsh","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-04-21T08:43:14Z","receivedAt":"2013-04-21T08:43:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Felipe Contreras <felipe.contreras@gmail.com> writes:\n\n> When this option is enabled, the prompt gets totally screwed in zsh\n> because all the codes start with % in zsh (like they are \\ in bas). So\n> we need to escape the % character.\n\nIt is not that I do not believe that $u needs to duplicate %% in\nZSH, but I hate it when I do not understand the explanation.  Could\nyou help me clarify what you meant by \"codes\" and \"like they are \\ in bas\"?\n\nAre you referring to things like \\u (user) \\h (host) as \"code\" and\n\"bas\" was a simple typo of \"bash\"?  In other words, does my reading\nbelow:\n\n\t... because '%' is used as an introducer of prompt\n\tcustomization in zsh (just like bash prompt uses '\\' to\n\tintroduce \\u, \\h, etc.), we need to give '%%' to get a\n\tliteral per-cent character.\n\nmatch what you meant to say?\n\n> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> ---\n>  contrib/completion/git-prompt.sh | 6 +++++-\n>  1 file changed, 5 insertions(+), 1 deletion(-)\n>\n> diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh\n> index 756a951..4bedbcc 100644\n> --- a/contrib/completion/git-prompt.sh\n> +++ b/contrib/completion/git-prompt.sh\n> @@ -340,7 +340,11 @@ __git_ps1 ()\n>  \t\t\t   [ \"$(git config --bool bash.showUntrackedFiles)\" != \"false\" ] &&\n>  \t\t\t   [ -n \"$(git ls-files --others --exclude-standard)\" ]\n>  \t\t\tthen\n> -\t\t\t\tu=\"%\"\n> +\t\t\t\tif [ -n \"${ZSH_VERSION-}\" ]; then\n> +\t\t\t\t\tu=\"%%\"\n> +\t\t\t\telse\n> +\t\t\t\t\tu=\"%\"\n> +\t\t\t\tfi\n>  \t\t\tfi\n>  \n>  \t\t\tif [ -n \"${GIT_PS1_SHOWUPSTREAM-}\" ]; then\n"},{"id":"214992","messageId":"7vli8cuv5j.fsf@alter.siamese.dyndns.org","threadId":"33558","inReplyTo":"m2fvyk8fb8.fsf@igel.home","subject":"Re: [PATCH] prompt: fix tracked files for zsh","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-04-21T08:48:08Z","receivedAt":"2013-04-21T08:48:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andreas Schwab <schwab@linux-m68k.org> writes:\n\n> Felipe Contreras <felipe.contreras@gmail.com> writes:\n>\n>> +\t\t\t\tif [ -n \"${ZSH_VERSION-}\" ]; then\n>> +\t\t\t\t\tu=\"%%\"\n>> +\t\t\t\telse\n>> +\t\t\t\t\tu=\"%\"\n>> +\t\t\t\tfi\n>\n> aka u=\"%${ZSH_VERSION:+%}\"\n\nDo you need/want a colon there?  Even if it is empty, as long as it\nis defined we would want this, no?\n\n>\n> Andreas.\n"},{"id":"215029","messageId":"m2a9or907f.fsf@igel.home","threadId":"33558","inReplyTo":"7vli8cuv5j.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] prompt: fix tracked files for zsh","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2013-04-21T19:02:12Z","receivedAt":"2013-04-21T19:02:12Z","isPatch":true,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Andreas Schwab <schwab@linux-m68k.org> writes:\n>\n>> Felipe Contreras <felipe.contreras@gmail.com> writes:\n>>\n>>> +\t\t\t\tif [ -n \"${ZSH_VERSION-}\" ]; then\n>>> +\t\t\t\t\tu=\"%%\"\n>>> +\t\t\t\telse\n>>> +\t\t\t\t\tu=\"%\"\n>>> +\t\t\t\tfi\n>>\n>> aka u=\"%${ZSH_VERSION:+%}\"\n>\n> Do you need/want a colon there?  Even if it is empty, as long as it\n> is defined we would want this, no?\n\nThe original wouldn't.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"215032","messageId":"CAMP44s36TO6DQ_3j7rSOoOM6QS-Y0DW_z6WX_GF3ODFfupb6jg@mail.gmail.com","threadId":"33558","inReplyTo":"m2a9or907f.fsf@igel.home","subject":"Re: [PATCH] prompt: fix tracked files for zsh","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-04-21T21:00:49Z","receivedAt":"2013-04-21T21:00:49Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Sun, Apr 21, 2013 at 2:02 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> Andreas Schwab <schwab@linux-m68k.org> writes:\n>>\n>>> Felipe Contreras <felipe.contreras@gmail.com> writes:\n>>>\n>>>> +                           if [ -n \"${ZSH_VERSION-}\" ]; then\n>>>> +                                   u=\"%%\"\n>>>> +                           else\n>>>> +                                   u=\"%\"\n>>>> +                           fi\n>>>\n>>> aka u=\"%${ZSH_VERSION:+%}\"\n>>\n>> Do you need/want a colon there?  Even if it is empty, as long as it\n>> is defined we would want this, no?\n>\n> The original wouldn't.\n\nI thought you were trying to improve the original ;)\n\n-- \nFelipe Contreras\n"},{"id":"215042","messageId":"7vehe3sfwv.fsf@alter.siamese.dyndns.org","threadId":"33558","inReplyTo":"CAMP44s36TO6DQ_3j7rSOoOM6QS-Y0DW_z6WX_GF3ODFfupb6jg@mail.gmail.com","subject":"Re: [PATCH] prompt: fix tracked files for zsh","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-04-21T22:00:16Z","receivedAt":"2013-04-21T22:00:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Felipe Contreras <felipe.contreras@gmail.com> writes:\n\n> On Sun, Apr 21, 2013 at 2:02 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:\n>> Junio C Hamano <gitster@pobox.com> writes:\n>>\n>>> Andreas Schwab <schwab@linux-m68k.org> writes:\n>>>\n>>>> Felipe Contreras <felipe.contreras@gmail.com> writes:\n>>>>\n>>>>> +                           if [ -n \"${ZSH_VERSION-}\" ]; then\n>>>>> +                                   u=\"%%\"\n>>>>> +                           else\n>>>>> +                                   u=\"%\"\n>>>>> +                           fi\n>>>>\n>>>> aka u=\"%${ZSH_VERSION:+%}\"\n>>>\n>>> Do you need/want a colon there?  Even if it is empty, as long as it\n>>> is defined we would want this, no?\n>>\n>> The original wouldn't.\n>\n> I thought you were trying to improve the original ;)\n\nOK, so I _think_ everybody is in agreement that the patch should\nlook like this.  OK?\n\n-- >8 --\nFrom: Felipe Contreras <felipe.contreras@gmail.com>\nSubject: [PATCH] prompt: fix untracked files for zsh\n\nWith \"bash.showUntrackedFiles\" option, presense of untracked files\nis signalled by adding a per-cent sign '%' to the prompt.  But\nbecause '%' is used as an escape character to introduce prompt\ncustomization in zsh (just like bash prompt uses '\\' to escape \\u,\n\\h, etc.), we need to say '%%' to get a literal per-cent.\n\nHelped-by: Andreas Schwab <schwab@linux-m68k.org>\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-prompt.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh\nindex 756a951..054c52e 100644\n--- a/contrib/completion/git-prompt.sh\n+++ b/contrib/completion/git-prompt.sh\n@@ -340,7 +340,7 @@ __git_ps1 ()\n \t\t\t   [ \"$(git config --bool bash.showUntrackedFiles)\" != \"false\" ] &&\n \t\t\t   [ -n \"$(git ls-files --others --exclude-standard)\" ]\n \t\t\tthen\n-\t\t\t\tu=\"%\"\n+\t\t\t\tu=\"%${ZSH_VERSION+%}\"\n \t\t\tfi\n \n \t\t\tif [ -n \"${GIT_PS1_SHOWUPSTREAM-}\" ]; then\n"},{"id":"215045","messageId":"CAMP44s0xMX2-sDzouYtCRzqRQLHOCdUDR_+G-50Mv9wG2P+EFQ@mail.gmail.com","threadId":"33558","inReplyTo":"7vehe3sfwv.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] prompt: fix tracked files for zsh","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-04-21T22:32:29Z","receivedAt":"2013-04-21T22:32:29Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Sun, Apr 21, 2013 at 5:00 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Felipe Contreras <felipe.contreras@gmail.com> writes:\n>\n>> On Sun, Apr 21, 2013 at 2:02 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:\n>>> Junio C Hamano <gitster@pobox.com> writes:\n>>>\n>>>> Andreas Schwab <schwab@linux-m68k.org> writes:\n>>>>\n>>>>> Felipe Contreras <felipe.contreras@gmail.com> writes:\n>>>>>\n>>>>>> +                           if [ -n \"${ZSH_VERSION-}\" ]; then\n>>>>>> +                                   u=\"%%\"\n>>>>>> +                           else\n>>>>>> +                                   u=\"%\"\n>>>>>> +                           fi\n>>>>>\n>>>>> aka u=\"%${ZSH_VERSION:+%}\"\n>>>>\n>>>> Do you need/want a colon there?  Even if it is empty, as long as it\n>>>> is defined we would want this, no?\n>>>\n>>> The original wouldn't.\n>>\n>> I thought you were trying to improve the original ;)\n>\n> OK, so I _think_ everybody is in agreement that the patch should\n> look like this.  OK?\n>\n> -- >8 --\n> From: Felipe Contreras <felipe.contreras@gmail.com>\n> Subject: [PATCH] prompt: fix untracked files for zsh\n>\n> With \"bash.showUntrackedFiles\" option,\n\nNot exactly correct, it can also be GIT_PS1_SHOWUNTRACKEDFILES.\n\n> presense of untracked files\n> is signalled by adding a per-cent sign '%' to the prompt.  But\n> because '%' is used as an escape character to introduce prompt\n> customization in zsh (just like bash prompt uses '\\' to escape \\u,\n> \\h, etc.), we need to say '%%' to get a literal per-cent.\n\nOtherwise it's fine.\n\nCheers.\n\n-- \nFelipe Contreras\n"}]}