Skip to content

Commit

Permalink
WIP: ahead/behind indicators for git
Browse files Browse the repository at this point in the history
  • Loading branch information
apjanke committed Jan 4, 2020
1 parent f45c1af commit 22e4d51
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions agnosterj.zsh-theme
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ prompt_context() {

# Git: branch/detached head, dirty status
prompt_git() {
local color ref mode
local color ref mode ahead behind
local SEGMENT_SEPARATOR BRANCH DETACHED PLUSMINUS CROSS LIGHTNING GEAR
define_prompt_chars
is_dirty() {
Expand All @@ -216,6 +216,10 @@ prompt_git() {
color=green
ref="${ref} "
fi
ahead=$(git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
(( $ahead )) && ref="${ref}"
behind=$(git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
(( $behind )) && ref="${ref}"
if [[ "${ref/.../}" == "$ref" ]]; then
ref="$BRANCH $ref"
else
Expand Down Expand Up @@ -407,7 +411,6 @@ prompt_gcp() {
fi
}


# Filesystem: filesystem on which the current working directory lies
prompt_filesystem() {
local fs=$(df "$PWD" | tail -1 | awk '{print $1}')
Expand Down

0 comments on commit 22e4d51

Please sign in to comment.