From 4ee00faa9d8960d3e457a19723921bf2173d4d72 Mon Sep 17 00:00:00 2001 From: "D. Ben Knoble" Date: Mon, 12 Oct 2026 13:48:28 -0400 Subject: [PATCH] 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 Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index d60e85479c..697fef5462 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -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