git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] prompt: fix show upstream with svn and zsh
@ 2013-05-21 20:54 Thomas Gummerer
  2013-05-21 22:41 ` SZEDER Gábor
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Thomas Gummerer @ 2013-05-21 20:54 UTC (permalink / raw)
  To: git; +Cc: felipe.contreras, gitster, szeder, t.gummerer

Currently the __git_ps1 git prompt gives the following error with a
repository converted by git-svn, when used with zsh:

	   __git_ps1_show_upstream:19: bad pattern: svn_remote[

This was introduced by 6d158cba (bash completion: Support "divergence
from upstream" messages in __git_ps1), when the script was for bash
only.  Make it compatible with zsh.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
---
Tested with bash 4.2.45 and zsh 5.0.2.

 contrib/completion/git-prompt.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index eaf5c36..e537300 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -124,7 +124,7 @@ __git_ps1_show_upstream ()
 			fi
 			;;
 		svn-remote.*.url)
-			svn_remote[ $((${#svn_remote[@]} + 1)) ]="$value"
+			svn_remote[$((${#svn_remote[@]} + 1))]="$value"
 			svn_url_pattern+="\\|$value"
 			upstream=svn+git # default upstream is SVN if available, else git
 			;;
@@ -146,8 +146,8 @@ __git_ps1_show_upstream ()
 	svn*)
 		# get the upstream from the "git-svn-id: ..." in a commit message
 		# (git-svn uses essentially the same procedure internally)
-		local svn_upstream=($(git log --first-parent -1 \
-					--grep="^git-svn-id: \(${svn_url_pattern#??}\)" 2>/dev/null))
+		set -a svn_upstream "$(git log --first-parent -1 \
+					--grep="^git-svn-id: \(${svn_url_pattern#??}\)" 2>/dev/null)"
 		if [[ 0 -ne ${#svn_upstream[@]} ]]; then
 			svn_upstream=${svn_upstream[ ${#svn_upstream[@]} - 2 ]}
 			svn_upstream=${svn_upstream%@*}
-- 
1.8.3.rc2.359.g2fb82f5

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-05-28 10:30 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-21 20:54 [PATCH] prompt: fix show upstream with svn and zsh Thomas Gummerer
2013-05-21 22:41 ` SZEDER Gábor
2013-05-21 23:04   ` Felipe Contreras
2013-05-21 23:36     ` SZEDER Gábor
2013-05-22  0:03       ` Felipe Contreras
2013-05-22  0:20         ` SZEDER Gábor
2013-05-22  0:29           ` Felipe Contreras
2013-05-22  0:44             ` SZEDER Gábor
2013-05-22  7:32   ` Thomas Gummerer
2013-05-28 10:30     ` SZEDER Gábor
2013-05-22  3:13 ` Felipe Contreras
2013-05-22  7:36   ` Thomas Gummerer
2013-05-22  7:40 ` [PATCH v2] " Thomas Gummerer
2013-05-22  7:56   ` Felipe Contreras

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).