1
0
mirror of https://github.com/robbyrussell/oh-my-zsh.git synced 2026-02-12 12:21:00 +01:00

[lib/git.zsh] Add git_commit_status

Signed-off-by: Olivier Mehani <shtrom@ssji.net>
This commit is contained in:
Olivier Mehani
2018-03-28 21:46:43 +11:00
committed by Olivier Mehani
parent 9521837240
commit d7c1e0404a

View File

@@ -112,6 +112,14 @@ function git_commits_behind() {
fi 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 # Outputs if current branch is ahead of remote
function git_prompt_ahead() { function git_prompt_ahead() {
if [[ -n "$(__git_prompt_git rev-list origin/$(git_current_branch)..HEAD 2> /dev/null)" ]]; then if [[ -n "$(__git_prompt_git rev-list origin/$(git_current_branch)..HEAD 2> /dev/null)" ]]; then