Skip to content

Commit

Permalink
Merge branch 'tg/maint-zsh-svn-remote-prompt'
Browse files Browse the repository at this point in the history
zsh prompt script that borrowed from bash prompt script did not
work due to slight differences in array variable notation between
these two shells.

* tg/maint-zsh-svn-remote-prompt:
  prompt: fix show upstream with svn and zsh
  • Loading branch information
Junio C Hamano committed Jun 5, 2013
2 parents 058a92a + d0583da commit 8cb9b5f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions contrib/completion/git-prompt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,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
;;
Expand All @@ -147,10 +147,11 @@ __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 \
local -a svn_upstream
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[${#svn_upstream[@]} - 2]}
svn_upstream=${svn_upstream%@*}
local n_stop="${#svn_remote[@]}"
for ((n=1; n <= n_stop; n++)); do
Expand Down

0 comments on commit 8cb9b5f

Please sign in to comment.