From 3256258ebfc04f34116b84b0af83e27e2dfb7400 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Sun, 11 Nov 2018 23:08:40 +0100 Subject: [PATCH] Count stashes via ZSH --- functions/vcs.zsh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 321a1502..bb877bec 100755 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -96,11 +96,9 @@ function +vi-git-tagname() { # Show count of stashed changes # Port from https://github.com/whiteinge/dotfiles/blob/5dfd08d30f7f2749cfc60bc55564c6ea239624d9/.zsh_shouse_prompt#L268 function +vi-git-stash() { - local -a stashes - - if [[ -s "${vcs_comm[gitdir]}/refs/stash" ]] ; then - stashes=$(command git stash list 2>/dev/null | wc -l) - hook_com[misc]+=" $(print_icon 'VCS_STASH_ICON')${stashes// /}" + if [[ -s "${vcs_comm[gitdir]}/logs/refs/stash" ]] ; then + local -a stashes=( "${(@f)"$(<${vcs_comm[gitdir]}/logs/refs/stash)"}" ) + hook_com[misc]+=" $(print_icon 'VCS_STASH_ICON')${#stashes}" fi }