Skip to content

Commit

Permalink
[git] Also check "commondir" when looking for a stash (sorin-ionescu#…
Browse files Browse the repository at this point in the history
  • Loading branch information
hotpxl authored and belak committed Sep 15, 2018
1 parent 7bb7a7c commit dd7a26e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions modules/git/functions/git-info
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,17 @@ function git-info {

# Format stashed.
zstyle -s ':prezto:module:git:info:stashed' format 'stashed_format'
if [[ -n "$stashed_format" && -f "$(git-dir)/refs/stash" ]]; then
stashed="$(command git stash list 2> /dev/null | wc -l | awk '{print $1}')"
if [[ -n "$stashed" ]]; then
zformat -f stashed_formatted "$stashed_format" "S:$stashed"
if [[ -n "$stashed_format" ]]; then
commondir=""
if [[ -f "$(git-dir)/commondir" ]]; then
commondir="$(<$(git-dir)/commondir)"
[[ "$commondir" =~ ^/ ]] || commondir="$(git-dir)/$commondir"
fi
if [[ -f "$(git-dir)/refs/stash" || ( -n "$commondir" && -f "$commondir/refs/stash" ) ]]; then
stashed="$(command git stash list 2> /dev/null | wc -l | awk '{print $1}')"
if [[ -n "$stashed" ]]; then
zformat -f stashed_formatted "$stashed_format" "S:$stashed"
fi
fi
fi

Expand Down

0 comments on commit dd7a26e

Please sign in to comment.