Merge branch 'tg/maint-zsh-svn-remote-prompt' into maint
authorJunio C Hamano <gitster@pobox.com>
Thu, 27 Jun 2013 21:38:14 +0000 (14:38 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 27 Jun 2013 21:38:14 +0000 (14:38 -0700)
* tg/maint-zsh-svn-remote-prompt:
prompt: fix show upstream with svn and zsh

1  2 
contrib/completion/git-prompt.sh
index eaf5c369aacde207cbad4c9df9574e7b26634bb7,d3de80f60b3a2d42e0e684ca73443c4d36f6cc3f..b6b1534c0287dadb7d3e47051fd892debf69e6b3
@@@ -124,7 -124,7 +124,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
                        ;;
        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
@@@ -263,21 -264,14 +264,21 @@@ __git_ps1 (
        else
                local r=""
                local b=""
 -              if [ -f "$g/rebase-merge/interactive" ]; then
 -                      r="|REBASE-i"
 -                      b="$(cat "$g/rebase-merge/head-name")"
 -              elif [ -d "$g/rebase-merge" ]; then
 -                      r="|REBASE-m"
 +              local step=""
 +              local total=""
 +              if [ -d "$g/rebase-merge" ]; then
                        b="$(cat "$g/rebase-merge/head-name")"
 +                      step=$(cat "$g/rebase-merge/msgnum")
 +                      total=$(cat "$g/rebase-merge/end")
 +                      if [ -f "$g/rebase-merge/interactive" ]; then
 +                              r="|REBASE-i"
 +                      else
 +                              r="|REBASE-m"
 +                      fi
                else
                        if [ -d "$g/rebase-apply" ]; then
 +                              step=$(cat "$g/rebase-apply/next")
 +                              total=$(cat "$g/rebase-apply/last")
                                if [ -f "$g/rebase-apply/rebasing" ]; then
                                        r="|REBASE"
                                elif [ -f "$g/rebase-apply/applying" ]; then
                        }
                fi
  
 +              if [ -n "$step" ] && [ -n "$total" ]; then
 +                      r="$r $step/$total"
 +              fi
 +
                local w=""
                local i=""
                local s=""