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

Re: [PATCH] prompt: fix show upstream with svn and zsh

From
SZEDER Gábor <szeder@ira.uka.de>
Date
May 21, 2013, 22:41 UTC
Message-ID
<20130521224119.GF30969@goldbirke>
In-Reply-To
<1369169667-25166-1-git-send-email-t.gummerer@gmail.com>
Hi,
On Tue, May 21, 2013 at 10:54:27PM +0200, Thomas Gummerer wrote:
Show 8 quoted lines
> 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.

What is the actual cause of this problem/incompatibility and how/why do these changes fix it?

> -			svn_remote[ $((${#svn_remote[@]} + 1)) ]="$value"
> +			svn_remote[$((${#svn_remote[@]} + 1))]="$value"
I mean, did zsh really complained because of the space after the '[' ?!
Show 10 quoted lines
> @@ -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 ]}
If so, then what about this one?

Best, Gábor

Previous: Thomas GummererNext: Felipe Contreras
Message 2 of 14 in “prompt: fix show upstream with svn and zsh”
  1. prompt: fix show upstream with svn and zshThomas Gummerer, May 21, 2013
  2. SZEDER GáborMay 21, 2013
  3. Felipe ContrerasMay 21, 2013
  4. SZEDER GáborMay 21, 2013
  5. Felipe ContrerasMay 22, 2013
  6. SZEDER GáborMay 22, 2013
  7. Felipe ContrerasMay 22, 2013
  8. SZEDER GáborMay 22, 2013
  9. Thomas GummererMay 22, 2013
  10. SZEDER GáborMay 28, 2013
  11. Felipe ContrerasMay 22, 2013
  12. Thomas GummererMay 22, 2013
  13. prompt: fix show upstream with svn and zshThomas Gummerer, May 22, 2013
  14. Felipe ContrerasMay 22, 2013

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.