Diff
1diff --git a/plugins/git-prompt/README.md b/plugins/git-prompt/README.md
2index 8775af89336973e208329d68d8db32b97cf6e29b..05208d72f81aba12941e3e0b83601fa7a68d9c5e 100644
3--- a/plugins/git-prompt/README.md
4+++ b/plugins/git-prompt/README.md
5@@ -45,6 +45,7 @@ The symbols are as follows:
6 | ●n | there are `n` staged files |
7 | ✖n | there are `n` unmerged files |
8 | ✚n | there are `n` unstaged files |
9+| -n | there are `n` deleted files |
10 | ⚑n | there are `n` stashed changes |
11 | … | there are some untracked files |
12
13@@ -59,6 +60,7 @@ The symbols are as follows:
14 ## Customisation
15
16 - Set the variable `ZSH_THEME_GIT_PROMPT_CACHE` to any value in order to enable caching.
17+- Set the variable `ZSH_THEME_GIT_SHOW_UPSTREAM` to any value to display the upstream branch.
18 - You may also change a number of variables (whose name start with `ZSH_THEME_GIT_PROMPT_`)
19 to change the appearance of the prompt. Take a look at the bottom of the [plugin file](git-prompt.plugin.zsh)`
20 to see what variables are available.
21diff --git a/plugins/git-prompt/git-prompt.plugin.zsh b/plugins/git-prompt/git-prompt.plugin.zsh
22index dcda418cfae88ac3db40bd8f16459fc4c2eb63f1..487332028a8beaa56731c7ebfa72fdc184dd1208 100644
23--- a/plugins/git-prompt/git-prompt.plugin.zsh
24+++ b/plugins/git-prompt/git-prompt.plugin.zsh
25@@ -48,12 +48,18 @@ function update_current_git_vars() {
26 GIT_STASHED=$__CURRENT_GIT_STATUS[8]
27 GIT_CLEAN=$__CURRENT_GIT_STATUS[9]
28 GIT_DELETED=$__CURRENT_GIT_STATUS[10]
29+
30+ if [ -z ${ZSH_THEME_GIT_SHOW_UPSTREAM+x} ]; then
31+ GIT_UPSTREAM=
32+ else
33+ GIT_UPSTREAM=$(git rev-parse --abbrev-ref --symbolic-full-name "@{upstream}" 2>/dev/null) && GIT_UPSTREAM="${ZSH_THEME_GIT_PROMPT_UPSTREAM_SEPARATOR}${GIT_UPSTREAM}"
34+ fi
35 }
36
37 git_super_status() {
38 precmd_update_git_vars
39 if [ -n "$__CURRENT_GIT_STATUS" ]; then
40- STATUS="$ZSH_THEME_GIT_PROMPT_PREFIX$ZSH_THEME_GIT_PROMPT_BRANCH$GIT_BRANCH%{${reset_color}%}"
41+ STATUS="$ZSH_THEME_GIT_PROMPT_PREFIX$ZSH_THEME_GIT_PROMPT_BRANCH$GIT_BRANCH$GIT_UPSTREAM%{${reset_color}%}"
42 if [ "$GIT_BEHIND" -ne "0" ]; then
43 STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_BEHIND$GIT_BEHIND%{${reset_color}%}"
44 fi
45@@ -101,6 +107,7 @@ ZSH_THEME_GIT_PROMPT_AHEAD="%{↑%G%}"
46 ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%}%{…%G%}"
47 ZSH_THEME_GIT_PROMPT_STASHED="%{$fg_bold[blue]%}%{⚑%G%}"
48 ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}%{✔%G%}"
49+ZSH_THEME_GIT_PROMPT_UPSTREAM_SEPARATOR="->"
50
51 # Set the prompt.
52 RPROMPT='$(git_super_status)'