1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-10-16 11:40:46 +00:00

Compare commits

...

2 commits

Author SHA1 Message Date
Olivier Mehani
8beb876c4e
Merge d7c1e0404a into 1514145a09 2024-09-19 11:50:37 +02:00
Olivier Mehani
d7c1e0404a
[lib/git.zsh] Add git_commit_status
Signed-off-by: Olivier Mehani <shtrom@ssji.net>
2020-07-24 10:17:34 +10:00

View file

@ -195,6 +195,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