From 52733cb3bb0b1c85230c5c69e6c7231fb41c67fe Mon Sep 17 00:00:00 2001 From: Tadaya Tsuyukubo <ttsuyukubo@adconion.com> Date: Thu, 26 Jan 2012 15:20:08 -0800 Subject: prompt git-remove as deleted --- lib/git.zsh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/git.zsh') diff --git a/lib/git.zsh b/lib/git.zsh index defa062c6..9c89c3664 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -54,6 +54,8 @@ git_prompt_status() { fi if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" + elif $(echo "$INDEX" | grep '^D ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" elif $(echo "$INDEX" | grep '^AD ' &> /dev/null); then STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" fi -- cgit v1.2.3-70-g09d2 From a3c2a2f6e8ff9db508070a905de056346386ef4f Mon Sep 17 00:00:00 2001 From: Caio Romão <caioromao@gmail.com> Date: Sun, 29 Jul 2012 20:18:26 +0200 Subject: Add branch status support to git_prompt_status MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch makes git_prompt_status support three new status variables: - ZSH_THEME_GIT_PROMPT_AHEAD - ZSH_THEME_GIT_PROMPT_BEHIND - ZSH_THEME_GIT_PROMPT_DIVERGED With these extra variables it's easy to see (1) if you have commits in your local branch that weren't pushed to the remote (AHEAD), (2) if there are commits in the remote that you haven't merged/rebased yet (BEHIND) or (3) if you have local unpushed commits AND the remote has some commits you haven't merged yet (DIVERGED). Refer to the first line displayed on `git status -b --porcelain`. An example setup in a .zsh-theme file would be: ZSH_THEME_GIT_PROMPT_AHEAD="↑" ZSH_THEME_GIT_PROMPT_BEHIND="↓" ZSH_THEME_GIT_PROMPT_DIVERGED="↕" --- lib/git.zsh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lib/git.zsh') diff --git a/lib/git.zsh b/lib/git.zsh index fb4ad8ca6..bca8bdc96 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -38,7 +38,7 @@ function git_prompt_long_sha() { # Get the status of the working tree git_prompt_status() { - INDEX=$(git status --porcelain 2> /dev/null) + INDEX=$(git status --porcelain -b 2> /dev/null) STATUS="" if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS" @@ -66,6 +66,15 @@ git_prompt_status() { if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS" fi + if $(echo "$INDEX" | grep '^## .*ahead' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_AHEAD$STATUS" + fi + if $(echo "$INDEX" | grep '^## .*behind' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_BEHIND$STATUS" + fi + if $(echo "$INDEX" | grep '^## .*diverged' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_DIVERGED$STATUS" + fi echo $STATUS } -- cgit v1.2.3-70-g09d2