Add Stashes count to Git Prompt (#188)

Introduce a new variable, `$theme_display_git_stashed_verbose`, which adds the stashes count to the prompt if set to `yes`
pull/197/head
Claudio Mezzasalma 5 years ago committed by Justin Hileman
parent 47f29c8d6b
commit 0a6df2de5a

@ -285,6 +285,17 @@ function __bobthefish_git_dirty_verbose -S -d 'Print a more verbose dirty state
echo "$changes " | string replace -r '(\+0/(-0)?|/-0)' ''
end
function __bobthefish_git_stashed -S -d 'Print the stashed state for the current branch'
if [ "$theme_display_git_stashed_verbose" = 'yes' ]
set -l stashed (command git rev-list --walk-reflogs --count refs/stash 2>/dev/null)
or return
echo -n "$git_stashed_glyph$stashed"
else
command git rev-parse --verify --quiet refs/stash >/dev/null; and echo -n "$git_stashed_glyph"
end
end
# ==============================
# Segment functions
@ -828,7 +839,7 @@ function __bobthefish_prompt_git -S -a git_root_dir -d 'Display the actual git s
end
set -l staged (command git diff --cached --no-ext-diff --quiet --exit-code 2>/dev/null; or echo -n "$git_staged_glyph")
set -l stashed (command git rev-parse --verify --quiet refs/stash >/dev/null; and echo -n "$git_stashed_glyph")
set -l stashed (__bobthefish_git_stashed)
set -l ahead (__bobthefish_git_ahead)
set -l new ''

Loading…
Cancel
Save