completion: extract common stash listing code

With no change in behavior, prepare to adjust how stashes are completed
by centralizing candidate generation.

Signed-off-by: D. Ben Knoble <ben.knoble@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
seen
D. Ben Knoble 2026-10-12 13:48:28 -04:00 committed by Junio C Hamano
parent 43f61f9f67
commit 4ee00faa9d
1 changed files with 7 additions and 4 deletions

View File

@ -3593,20 +3593,23 @@ _git_stash ()
if [ $cword -eq $((__git_cmd_idx+2)) ]; then
__git_complete_refs
else
__gitcomp_nl "$(__git stash list \
| sed -n -e 's/:.*//p')"
__git_complete_stashes
fi
;;
import,*)
__git_complete_refs
;;
show,*|apply,*|drop,*|pop,*|export,*)
__gitcomp_nl "$(__git stash list \
| sed -n -e 's/:.*//p')"
__git_complete_stashes
;;
esac
}

__git_complete_stashes ()
{
__gitcomp_nl "$(__git stash list | sed -n -e 's/:.*//p')"
}

_git_submodule ()
{
__git_has_doubledash && return