Merge branch 'tg/maint-zsh-svn-remote-prompt' into maint

* tg/maint-zsh-svn-remote-prompt:
  prompt: fix show upstream with svn and zsh
This commit is contained in:
Junio C Hamano 2013-06-27 14:38:14 -07:00
commit f79467ef36

View File

@ -124,7 +124,7 @@ __git_ps1_show_upstream ()
fi fi
;; ;;
svn-remote.*.url) svn-remote.*.url)
svn_remote[ $((${#svn_remote[@]} + 1)) ]="$value" svn_remote[$((${#svn_remote[@]} + 1))]="$value"
svn_url_pattern+="\\|$value" svn_url_pattern+="\\|$value"
upstream=svn+git # default upstream is SVN if available, else git upstream=svn+git # default upstream is SVN if available, else git
;; ;;
@ -146,10 +146,11 @@ __git_ps1_show_upstream ()
svn*) svn*)
# get the upstream from the "git-svn-id: ..." in a commit message # get the upstream from the "git-svn-id: ..." in a commit message
# (git-svn uses essentially the same procedure internally) # (git-svn uses essentially the same procedure internally)
local svn_upstream=($(git log --first-parent -1 \ local -a svn_upstream
svn_upstream=($(git log --first-parent -1 \
--grep="^git-svn-id: \(${svn_url_pattern#??}\)" 2>/dev/null)) --grep="^git-svn-id: \(${svn_url_pattern#??}\)" 2>/dev/null))
if [[ 0 -ne ${#svn_upstream[@]} ]]; then if [[ 0 -ne ${#svn_upstream[@]} ]]; then
svn_upstream=${svn_upstream[ ${#svn_upstream[@]} - 2 ]} svn_upstream=${svn_upstream[${#svn_upstream[@]} - 2]}
svn_upstream=${svn_upstream%@*} svn_upstream=${svn_upstream%@*}
local n_stop="${#svn_remote[@]}" local n_stop="${#svn_remote[@]}"
for ((n=1; n <= n_stop; n++)); do for ((n=1; n <= n_stop; n++)); do