* [PATCH] completion: add stash import, export
@ 2026-02-07 21:59 D. Ben Knoble
2026-02-08 1:33 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: D. Ben Knoble @ 2026-02-07 21:59 UTC (permalink / raw)
To: git; +Cc: D. Ben Knoble, Denton Liu, Junio C Hamano
These newer commands lack completion; implement basic support for
options and arguments.
Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>
---
Notes (benknoble/commits):
- t/t9902-completion.sh passes
- advice on completing the --to-ref argument welcome, but I also think
it's acceptable to not offer any completion there
I happened to build this off of next, but it applies cleanly to master
(which is probably the most appropriate base).
contrib/completion/git-completion.bash | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 538dff1ee5..a8e7c6ddbf 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -3465,7 +3465,7 @@ _git_sparse_checkout ()
_git_stash ()
{
- local subcommands='push list show apply clear drop pop create branch'
+ local subcommands='push list show apply clear drop pop create branch import export'
local subcommand="$(__git_find_on_cmdline "$subcommands save")"
if [ -z "$subcommand" ]; then
@@ -3491,6 +3491,9 @@ _git_stash ()
show,--*)
__gitcomp_builtin stash_show "$__git_diff_common_options"
;;
+ export,--*)
+ __gitcomp_builtin stash_export "--print --to-ref"
+ ;;
*,--*)
__gitcomp_builtin "stash_$subcommand"
;;
@@ -3502,7 +3505,10 @@ _git_stash ()
| sed -n -e 's/:.*//p')"
fi
;;
- show,*|apply,*|drop,*|pop,*)
+ import,*)
+ __git_complete_refs
+ ;;
+ show,*|apply,*|drop,*|pop,*|export,*)
__gitcomp_nl "$(__git stash list \
| sed -n -e 's/:.*//p')"
;;
base-commit: 2a3d6836805534f45cf545da7be25ce1c759c514
--
2.52.0.rc0.971.g305ecc6b61.dirty
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] completion: add stash import, export
2026-02-07 21:59 [PATCH] completion: add stash import, export D. Ben Knoble
@ 2026-02-08 1:33 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2026-02-08 1:33 UTC (permalink / raw)
To: D. Ben Knoble; +Cc: git, Denton Liu
"D. Ben Knoble" <ben.knoble+github@gmail.com> writes:
> These newer commands lack completion; implement basic support for
> options and arguments.
>
> Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>
> ---
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 538dff1ee5..a8e7c6ddbf 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -3465,7 +3465,7 @@ _git_sparse_checkout ()
>
> _git_stash ()
> {
> - local subcommands='push list show apply clear drop pop create branch'
> + local subcommands='push list show apply clear drop pop create branch import export'
Makes sense, but in the longer term, we should devise a way to make
this script and parse-options infrastructure cooperate so that we do
not have to update it, just like options are completed using the
special "git cmd --git-completion-helper" option.
In any case, will apply. Thanks.
> @@ -3491,6 +3491,9 @@ _git_stash ()
> show,--*)
> __gitcomp_builtin stash_show "$__git_diff_common_options"
> ;;
> + export,--*)
> + __gitcomp_builtin stash_export "--print --to-ref"
> + ;;
> *,--*)
> __gitcomp_builtin "stash_$subcommand"
> ;;
> @@ -3502,7 +3505,10 @@ _git_stash ()
> | sed -n -e 's/:.*//p')"
> fi
> ;;
> - show,*|apply,*|drop,*|pop,*)
> + import,*)
> + __git_complete_refs
> + ;;
> + show,*|apply,*|drop,*|pop,*|export,*)
> __gitcomp_nl "$(__git stash list \
> | sed -n -e 's/:.*//p')"
> ;;
>
> base-commit: 2a3d6836805534f45cf545da7be25ce1c759c514
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-08 1:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-07 21:59 [PATCH] completion: add stash import, export D. Ben Knoble
2026-02-08 1:33 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox