File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6060# of values:
6161#
6262# verbose show number of commits ahead/behind (+/-) upstream
63+ # name if verbose, then also show the upstream abbrev name
6364# legacy don't use the '--count' option available in recent
6465# versions of git-rev-list
6566# git always compare HEAD to @{upstream}
@@ -94,7 +95,7 @@ __git_ps1_show_upstream ()
9495{
9596 local key value
9697 local svn_remote svn_url_pattern count n
97- local upstream=git legacy=" " verbose=" "
98+ local upstream=git legacy=" " verbose=" " name= " "
9899
99100 svn_remote=()
100101 # get some config options from git-config
@@ -122,6 +123,7 @@ __git_ps1_show_upstream ()
122123 git|svn) upstream=" $option " ;;
123124 verbose) verbose=1 ;;
124125 legacy) legacy=1 ;;
126+ name) name=1 ;;
125127 esac
126128 done
127129
@@ -204,6 +206,9 @@ __git_ps1_show_upstream ()
204206 * ) # diverged from upstream
205207 p=" u+${count#* } -${count% * } " ;;
206208 esac
209+ if [[ -n " $count " && -n " $name " ]]; then
210+ p=" $p $( git rev-parse --abbrev-ref " $upstream " 2> /dev/null) "
211+ fi
207212 fi
208213
209214}
You can’t perform that action at this time.
0 commit comments