aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Ritter <dritter03@googlemail.com>2018-11-12 01:08:40 +0300
committerDominik Ritter <dritter03@googlemail.com>2018-11-12 01:16:44 +0300
commit3256258ebfc04f34116b84b0af83e27e2dfb7400 (patch)
tree3ffe58466e322e29bb12c7567ff92fa6d2ac64f8
parent78df520772135b7924d6fc84f2bdbde0f1c650b2 (diff)
Count stashes via ZSH
-rwxr-xr-xfunctions/vcs.zsh8
1 files 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
}