From d7c1e0404ab02cc40fb4ea03de680899d5bd91d2 Mon Sep 17 00:00:00 2001 From: Olivier Mehani Date: Wed, 28 Mar 2018 21:46:43 +1100 Subject: [PATCH] [lib/git.zsh] Add git_commit_status Signed-off-by: Olivier Mehani --- lib/git.zsh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/git.zsh b/lib/git.zsh index ffc7c01a1..9c5949161 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -112,6 +112,14 @@ function git_commits_behind() { fi } +function git_commits_status() { + local ahead=$(git_commits_ahead) + local behind=$(git_commits_behind) + if [[ -n "$ahead$behind" ]]; then + echo "$ZSH_THEME_GIT_COMMITS_STATUS_PREFIX$ahead$behind$ZSH_THEME_GIT_COMMITS_STATUS_SUFFIX" + fi +} + # Outputs if current branch is ahead of remote function git_prompt_ahead() { if [[ -n "$(__git_prompt_git rev-list origin/$(git_current_branch)..HEAD 2> /dev/null)" ]]; then