From 3a7a5908626c977e9fccaceda3ffeba67c5f1548 Mon Sep 17 00:00:00 2001 From: nyim Date: Mon, 2 Jul 2018 02:41:52 +0800 Subject: [PATCH] mortalscumbag add icon showing local branch behind (#4364) --- themes/mortalscumbag.zsh-theme | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/themes/mortalscumbag.zsh-theme b/themes/mortalscumbag.zsh-theme index 55ece9760..8c7b0f5d1 100644 --- a/themes/mortalscumbag.zsh-theme +++ b/themes/mortalscumbag.zsh-theme @@ -9,6 +9,11 @@ function my_git_prompt() { STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" fi + # is branch behind? + if $(echo "$(git log HEAD..origin/$(current_branch) 2> /dev/null)" | grep '^commit' &> /dev/null); then + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_BEHIND" + fi + # is anything staged? if $(echo "$INDEX" | command grep -E -e '^(D[ M]|[MARC][ MD]) ' &> /dev/null); then STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED" @@ -52,6 +57,7 @@ PROMPT=$'\n$(ssh_connection)%{$fg_bold[green]%}%n@%m%{$reset_color%}$(my_git_pro ZSH_THEME_PROMPT_RETURNCODE_PREFIX="%{$fg_bold[red]%}" ZSH_THEME_GIT_PROMPT_PREFIX=" $fg[white]‹ %{$fg_bold[yellow]%}" ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg_bold[magenta]%}↑" +ZSH_THEME_GIT_PROMPT_BEHIND="%{$fg_bold[green]%}↓" ZSH_THEME_GIT_PROMPT_STAGED="%{$fg_bold[green]%}●" ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg_bold[red]%}●" ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[white]%}●"