1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-06-29 10:17:25 +00:00

[git] Also check "commondir" when looking for a stash (#1620)

This commit is contained in:
Yutian Li 2018-09-15 12:35:48 -04:00 committed by Kaleb Elwert
parent 7bb7a7cb6f
commit dd7a26e219

View File

@ -212,12 +212,19 @@ function git-info {
# Format stashed. # Format stashed.
zstyle -s ':prezto:module:git:info:stashed' format 'stashed_format' zstyle -s ':prezto:module:git:info:stashed' format 'stashed_format'
if [[ -n "$stashed_format" && -f "$(git-dir)/refs/stash" ]]; then 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}')" stashed="$(command git stash list 2> /dev/null | wc -l | awk '{print $1}')"
if [[ -n "$stashed" ]]; then if [[ -n "$stashed" ]]; then
zformat -f stashed_formatted "$stashed_format" "S:$stashed" zformat -f stashed_formatted "$stashed_format" "S:$stashed"
fi fi
fi fi
fi
# Format action. # Format action.
zstyle -s ':prezto:module:git:info:action' format 'action_format' zstyle -s ':prezto:module:git:info:action' format 'action_format'