Re: [PATCH v2] completion: use builtin completion for format-patch

2 messages, 2 authors, 2018-11-01 · open the first message on its own page

Re: [PATCH v2] completion: use builtin completion for format-patch

From: Junio C Hamano <hidden>
Date: 2018-11-01 01:42:12

Duy Nguyen [off-list ref] writes:
quoted
-__git_format_patch_options="
-       --stdout --attach --no-attach --thread --thread= --no-thread
-       --numbered --start-number --numbered-files --keep-subject --signoff
-       --signature --no-signature --in-reply-to= --cc= --full-index --binary
-       --not --all --cover-letter --no-prefix --src-prefix= --dst-prefix=
-       --inline --suffix= --ignore-if-in-upstream --subject-prefix=
-       --output-directory --reroll-count --to= --quiet --notes
-"
-
 _git_format_patch ()
 {
        case "$cur" in
@@ -1550,7 +1541,7 @@ _git_format_patch ()
                return
                ;;
        --*)
-               __gitcomp "$__git_format_patch_options"
+               __gitcomp_builtin format-patch
We do want to keep some extra options back because __gitcomp_builtin
cannot show all supported options of format-patch. The reason is a
subset of options is handled by setup_revisions() which does not have
--git-completion-helper support.
Yeah, that is one of the differences I saw compared to the older
one; thanks for being a careful reviewer.

quoted
@@ -2080,16 +2071,19 @@ _git_send_email ()
                return
                ;;
        --*)
-               __gitcomp "--annotate --bcc --cc --cc-cmd --chain-reply-to
-                       --compose --confirm= --dry-run --envelope-sender
-                       --from --identity
-                       --in-reply-to --no-chain-reply-to --no-signed-off-by-cc
-                       --no-suppress-from --no-thread --quiet --reply-to
-                       --signed-off-by-cc --smtp-pass --smtp-server
-                       --smtp-server-port --smtp-encryption= --smtp-user
-                       --subject --suppress-cc= --suppress-from --thread --to
-                       --validate --no-validate
-                       $__git_format_patch_options"
+               __gitcomp "--all --annotate --attach --bcc --binary --cc --cc= --cc-cmd
+                       --chain-reply-to --compose --confirm= --cover-letter --dry-run
+                       --dst-prefix= --envelope-sender --from --full-index --identity
+                       --ignore-if-in-upstream --inline --in-reply-to --in-reply-to=
+                       --keep-subject --no-attach --no-chain-reply-to --no-prefix
+                       --no-signature --no-signed-off-by-cc --no-suppress-from --not --notes
+                       --no-thread --no-validate --numbered --numbered-files
+                       --output-directory --quiet --reply-to --reroll-count --signature
+                       --signed-off-by-cc --signoff --smtp-encryption= --smtp-pass
+                       --smtp-server --smtp-server-port --smtp-user --src-prefix=
+                       --start-number --stdout --subject --subject-prefix= --suffix=
+                       --suppress-cc= --suppress-from --thread --thread= --to --to=
+                       --validate"
I have no comment about this. In an ideal world, sendemail.perl could
be taught to support --git-completion-helper but I don't think my
little remaining Perl knowledge (or time) is enough to do it. Perhaps
this will do. I don't know.
So "all", "attach", etc. are added to this list while these similar
options are lost from the other variable?  Is this a good trade-off?

Re: [PATCH v2] completion: use builtin completion for format-patch

From: Duy Nguyen <hidden>
Date: 2018-11-01 15:41:26

On Thu, Nov 1, 2018 at 2:42 AM Junio C Hamano [off-list ref] wrote:
quoted
quoted
@@ -2080,16 +2071,19 @@ _git_send_email ()
                return
                ;;
        --*)
-               __gitcomp "--annotate --bcc --cc --cc-cmd --chain-reply-to
-                       --compose --confirm= --dry-run --envelope-sender
-                       --from --identity
-                       --in-reply-to --no-chain-reply-to --no-signed-off-by-cc
-                       --no-suppress-from --no-thread --quiet --reply-to
-                       --signed-off-by-cc --smtp-pass --smtp-server
-                       --smtp-server-port --smtp-encryption= --smtp-user
-                       --subject --suppress-cc= --suppress-from --thread --to
-                       --validate --no-validate
-                       $__git_format_patch_options"
+               __gitcomp "--all --annotate --attach --bcc --binary --cc --cc= --cc-cmd
+                       --chain-reply-to --compose --confirm= --cover-letter --dry-run
+                       --dst-prefix= --envelope-sender --from --full-index --identity
+                       --ignore-if-in-upstream --inline --in-reply-to --in-reply-to=
+                       --keep-subject --no-attach --no-chain-reply-to --no-prefix
+                       --no-signature --no-signed-off-by-cc --no-suppress-from --not --notes
+                       --no-thread --no-validate --numbered --numbered-files
+                       --output-directory --quiet --reply-to --reroll-count --signature
+                       --signed-off-by-cc --signoff --smtp-encryption= --smtp-pass
+                       --smtp-server --smtp-server-port --smtp-user --src-prefix=
+                       --start-number --stdout --subject --subject-prefix= --suffix=
+                       --suppress-cc= --suppress-from --thread --thread= --to --to=
+                       --validate"
I have no comment about this. In an ideal world, sendemail.perl could
be taught to support --git-completion-helper but I don't think my
little remaining Perl knowledge (or time) is enough to do it. Perhaps
this will do. I don't know.
So "all", "attach", etc. are added to this list while these similar
options are lost from the other variable?  Is this a good trade-off?
Not sure if I understand you correctly, but it looks to me that the
options in git-send-email.perl are well organized, so we could add
--git-completon-helper in that script to print all send-email specific
options, then call "git format-patch --git-completion-helper" to add a
bunch more. The options that are handled by setup_revisions() will
have to be maintained manually here like $__git_format_patch_options
and added on top in both _git_send_email () and _git_format_patch ().

So, nothing option is lost and by the time setup_revisions() supports
-git-completion-helper, we can get rid of the manual shell variable
too. The downside is, lots of work, probably.
-- 
Duy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help