From: Junio C Hamano Date: Mon, 28 Oct 2013 17:43:38 +0000 (-0700) Subject: Merge branch 'sg/prompt-svn-remote-fix' X-Git-Tag: v1.8.5-rc0~20 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/9f279af86206e36e9ecd25ab81515e0af81bf2ad?ds=inline;hp=-c Merge branch 'sg/prompt-svn-remote-fix' Bash portability fix. * sg/prompt-svn-remote-fix: bash prompt: don't use '+=' operator in show upstream code path --- 9f279af86206e36e9ecd25ab81515e0af81bf2ad diff --combined contrib/completion/git-prompt.sh index 202e2e520f,998722cf7f..7b732d2aeb --- a/contrib/completion/git-prompt.sh +++ b/contrib/completion/git-prompt.sh @@@ -60,7 -60,6 +60,7 @@@ # of values: # # verbose show number of commits ahead/behind (+/-) upstream +# name if verbose, then also show the upstream abbrev name # legacy don't use the '--count' option available in recent # versions of git-rev-list # git always compare HEAD to @{upstream} @@@ -95,7 -94,7 +95,7 @@@ __git_ps1_show_upstream ( { local key value local svn_remote svn_url_pattern count n - local upstream=git legacy="" verbose="" + local upstream=git legacy="" verbose="" name="" svn_remote=() # get some config options from git-config @@@ -111,7 -110,7 +111,7 @@@ ;; svn-remote.*.url) svn_remote[$((${#svn_remote[@]} + 1))]="$value" - svn_url_pattern+="\\|$value" + svn_url_pattern="$svn_url_pattern\\|$value" upstream=svn+git # default upstream is SVN if available, else git ;; esac @@@ -123,7 -122,6 +123,7 @@@ git|svn) upstream="$option" ;; verbose) verbose=1 ;; legacy) legacy=1 ;; + name) name=1 ;; esac done @@@ -206,9 -204,6 +206,9 @@@ *) # diverged from upstream p=" u+${count#* }-${count% *}" ;; esac + if [[ -n "$count" && -n "$name" ]]; then + p="$p $(git rev-parse --abbrev-ref "$upstream" 2>/dev/null)" + fi fi }