Skip to content

Commit f79467e

Browse files
committed
Merge branch 'tg/maint-zsh-svn-remote-prompt' into maint
* tg/maint-zsh-svn-remote-prompt: prompt: fix show upstream with svn and zsh
2 parents fc78791 + d0583da commit f79467e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

contrib/completion/git-prompt.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ __git_ps1_show_upstream ()
124124
fi
125125
;;
126126
svn-remote.*.url)
127-
svn_remote[ $((${#svn_remote[@]} + 1)) ]="$value"
127+
svn_remote[$((${#svn_remote[@]} + 1))]="$value"
128128
svn_url_pattern+="\\|$value"
129129
upstream=svn+git # default upstream is SVN if available, else git
130130
;;
@@ -146,10 +146,11 @@ __git_ps1_show_upstream ()
146146
svn*)
147147
# get the upstream from the "git-svn-id: ..." in a commit message
148148
# (git-svn uses essentially the same procedure internally)
149-
local svn_upstream=($(git log --first-parent -1 \
149+
local -a svn_upstream
150+
svn_upstream=($(git log --first-parent -1 \
150151
--grep="^git-svn-id: \(${svn_url_pattern#??}\)" 2>/dev/null))
151152
if [[ 0 -ne ${#svn_upstream[@]} ]]; then
152-
svn_upstream=${svn_upstream[ ${#svn_upstream[@]} - 2 ]}
153+
svn_upstream=${svn_upstream[${#svn_upstream[@]} - 2]}
153154
svn_upstream=${svn_upstream%@*}
154155
local n_stop="${#svn_remote[@]}"
155156
for ((n=1; n <= n_stop; n++)); do

0 commit comments

Comments
 (0)