SZEDER Gábor <sze...@ira.uka.de> writes:

> Hi,
>
>
> On Tue, May 21, 2013 at 10:54:27PM +0200, Thomas Gummerer wrote:
>> 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 '[' ?!

Yes, removing the spaces after the '[' fixes the problem.  I'm not very
proficient in shell scripting, so I can't tell if there is another
cause.

>> @@ -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?

You're right, this line gives an error too, the code just wasn't
following that path before.  I'll fix it in the re-roll.  Other than
those two I couldn't spot any other occurrence of this pattern.

> Best,
> Gábor

Thanks,
Thomas
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to