Skip to content

Commit

Permalink
Fix git stash count always being 1
Browse files Browse the repository at this point in the history
When I converted this, I never actually confirmed that the command would
return the right number of lines for how many stashes there were. Turns
out it doesn't, only the return code was doing what I expected.

This new command directly returns the number of stashes, which means we
can skip the line count too.
  • Loading branch information
Rycieos committed Nov 25, 2020
1 parent cb9d71b commit bb19836
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions liquidprompt
Original file line number Diff line number Diff line change
Expand Up @@ -1320,10 +1320,7 @@ _lp_git_head_status() {
# return: true if any stashes are found.
# lp_vcs_stash_count; the number of stashes.
_lp_git_stash_count() {
local stashes count
stashes="$(\git rev-parse --verify -q refs/stash 2>/dev/null; printf x)"
__lp_line_count "${stashes%x}"
lp_vcs_stash_count=$count
lp_vcs_stash_count="$(\git rev-list --walk-reflogs --count refs/stash 2>/dev/null)"
(( lp_vcs_stash_count ))
}

Expand Down

0 comments on commit bb19836

Please sign in to comment.