{"thread":{"id":"64939","subject":"[PATCH] completion: add stash import, export","startedAt":"2026-02-07T21:59:45Z","lastAt":"2026-02-08T01:33:31Z","messageCount":2,"participants":["D. Ben Knoble","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"535450","messageId":"20260207215924.28863-1-ben.knoble+github@gmail.com","threadId":"64939","inReplyTo":null,"subject":"[PATCH] completion: add stash import, export","fromName":"D. Ben Knoble","fromEmail":"ben.knoble+github@gmail.com","sentAt":"2026-02-07T21:59:16Z","receivedAt":"2026-02-07T21:59:45Z","isPatch":true,"sender":{"key":"ben.knoble@gmail.com","avatar":"https://avatars.githubusercontent.com/u/22802209?v=4"},"body":"These newer commands lack completion; implement basic support for\noptions and arguments.\n\nSigned-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>\n---\n\nNotes (benknoble/commits):\n    - t/t9902-completion.sh passes\n    - advice on completing the --to-ref argument welcome, but I also think\n      it's acceptable to not offer any completion there\n    \n    I happened to build this off of next, but it applies cleanly to master\n    (which is probably the most appropriate base).\n\n contrib/completion/git-completion.bash | 10 ++++++++--\n 1 file changed, 8 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 538dff1ee5..a8e7c6ddbf 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -3465,7 +3465,7 @@ _git_sparse_checkout ()\n \n _git_stash ()\n {\n-\tlocal subcommands='push list show apply clear drop pop create branch'\n+\tlocal subcommands='push list show apply clear drop pop create branch import export'\n \tlocal subcommand=\"$(__git_find_on_cmdline \"$subcommands save\")\"\n \n \tif [ -z \"$subcommand\" ]; then\n@@ -3491,6 +3491,9 @@ _git_stash ()\n \tshow,--*)\n \t\t__gitcomp_builtin stash_show \"$__git_diff_common_options\"\n \t\t;;\n+\texport,--*)\n+\t\t__gitcomp_builtin stash_export \"--print --to-ref\"\n+\t\t;;\n \t*,--*)\n \t\t__gitcomp_builtin \"stash_$subcommand\"\n \t\t;;\n@@ -3502,7 +3505,10 @@ _git_stash ()\n \t\t\t\t\t| sed -n -e 's/:.*//p')\"\n \t\tfi\n \t\t;;\n-\tshow,*|apply,*|drop,*|pop,*)\n+\timport,*)\n+\t\t__git_complete_refs\n+\t\t;;\n+\tshow,*|apply,*|drop,*|pop,*|export,*)\n \t\t__gitcomp_nl \"$(__git stash list \\\n \t\t\t\t| sed -n -e 's/:.*//p')\"\n \t\t;;\n\nbase-commit: 2a3d6836805534f45cf545da7be25ce1c759c514\n-- \n2.52.0.rc0.971.g305ecc6b61.dirty\n\n"},{"id":"535457","messageId":"xmqqpl6g9fyu.fsf@gitster.g","threadId":"64939","inReplyTo":"20260207215924.28863-1-ben.knoble+github@gmail.com","subject":"Re: [PATCH] completion: add stash import, export","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-02-08T01:33:29Z","receivedAt":"2026-02-08T01:33:31Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"D. Ben Knoble\" <ben.knoble+github@gmail.com> writes:\n\n> These newer commands lack completion; implement basic support for\n> options and arguments.\n>\n> Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>\n> ---\n> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n> index 538dff1ee5..a8e7c6ddbf 100644\n> --- a/contrib/completion/git-completion.bash\n> +++ b/contrib/completion/git-completion.bash\n> @@ -3465,7 +3465,7 @@ _git_sparse_checkout ()\n>  \n>  _git_stash ()\n>  {\n> -\tlocal subcommands='push list show apply clear drop pop create branch'\n> +\tlocal subcommands='push list show apply clear drop pop create branch import export'\n\nMakes sense, but in the longer term, we should devise a way to make\nthis script and parse-options infrastructure cooperate so that we do\nnot have to update it, just like options are completed using the\nspecial \"git cmd --git-completion-helper\" option.\n\nIn any case, will apply.  Thanks.\n\n> @@ -3491,6 +3491,9 @@ _git_stash ()\n>  \tshow,--*)\n>  \t\t__gitcomp_builtin stash_show \"$__git_diff_common_options\"\n>  \t\t;;\n> +\texport,--*)\n> +\t\t__gitcomp_builtin stash_export \"--print --to-ref\"\n> +\t\t;;\n>  \t*,--*)\n>  \t\t__gitcomp_builtin \"stash_$subcommand\"\n>  \t\t;;\n> @@ -3502,7 +3505,10 @@ _git_stash ()\n>  \t\t\t\t\t| sed -n -e 's/:.*//p')\"\n>  \t\tfi\n>  \t\t;;\n> -\tshow,*|apply,*|drop,*|pop,*)\n> +\timport,*)\n> +\t\t__git_complete_refs\n> +\t\t;;\n> +\tshow,*|apply,*|drop,*|pop,*|export,*)\n>  \t\t__gitcomp_nl \"$(__git stash list \\\n>  \t\t\t\t| sed -n -e 's/:.*//p')\"\n>  \t\t;;\n>\n> base-commit: 2a3d6836805534f45cf545da7be25ce1c759c514\n"}]}