@@ -2359,16 +2359,7 @@ _git_send_email ()
return
;;
--*)
- __gitcomp_builtin send-email "--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_extra_options"
+ __gitcomp_builtin send-email "$__git_format_patch_extra_options"
return
;;
esac
@@ -114,6 +114,40 @@ sub usage {
}
sub completion_helper {
+ my @send_email_flags = qw/
+ --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
+ /;
+ print "@send_email_flags";
print Git::command('format-patch', '--git-completion-helper');
print "\n";
exit(0);
@@ -2139,6 +2139,9 @@ test_expect_success PERL 'send-email' '
--cover-from-description=Z
--cover-letter Z
EOF
+ test_completion "git send-email --val" <<-\EOF &&
+ --validate Z
+ EOF
test_completion "git send-email ma" "main "
'
As far as bash-completion is concerned, this refactoring is a no-op. However, this improves `git send-email --git-completion-helper`, which was previously printing only `git format-patch` flags, to print `send-email` specific flags as well. Add a completion test for `--validate` which is a send-email specific option. Signed-off-by: Thiago Perrotta <tbperrotta@gmail.com> --- contrib/completion/git-completion.bash | 11 +-------- git-send-email.perl | 34 ++++++++++++++++++++++++++ t/t9902-completion.sh | 3 +++ 3 files changed, 38 insertions(+), 10 deletions(-)