Skip to content

Commit 95182c6

Browse files
committed
Merge branch 'nd/complete-format-patch'
The support for format-patch (and send-email) by the command-line completion script (in contrib/) has been simplified a bit. * nd/complete-format-patch: completion: use __gitcomp_builtin for format-patch
2 parents 1e4a714 + 1337498 commit 95182c6

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

contrib/completion/git-completion.bash

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,13 +1521,9 @@ _git_fetch ()
15211521
__git_complete_remote_or_refspec
15221522
}
15231523

1524-
__git_format_patch_options="
1525-
--stdout --attach --no-attach --thread --thread= --no-thread
1526-
--numbered --start-number --numbered-files --keep-subject --signoff
1527-
--signature --no-signature --in-reply-to= --cc= --full-index --binary
1528-
--not --all --cover-letter --no-prefix --src-prefix= --dst-prefix=
1529-
--inline --suffix= --ignore-if-in-upstream --subject-prefix=
1530-
--output-directory --reroll-count --to= --quiet --notes
1524+
__git_format_patch_extra_options="
1525+
--full-index --not --all --no-prefix --src-prefix=
1526+
--dst-prefix= --notes
15311527
"
15321528

15331529
_git_format_patch ()
@@ -1540,7 +1536,7 @@ _git_format_patch ()
15401536
return
15411537
;;
15421538
--*)
1543-
__gitcomp "$__git_format_patch_options"
1539+
__gitcomp_builtin format-patch "$__git_format_patch_extra_options"
15441540
return
15451541
;;
15461542
esac
@@ -2070,7 +2066,7 @@ _git_send_email ()
20702066
return
20712067
;;
20722068
--*)
2073-
__gitcomp "--annotate --bcc --cc --cc-cmd --chain-reply-to
2069+
__gitcomp_builtin send-email "--annotate --bcc --cc --cc-cmd --chain-reply-to
20742070
--compose --confirm= --dry-run --envelope-sender
20752071
--from --identity
20762072
--in-reply-to --no-chain-reply-to --no-signed-off-by-cc
@@ -2079,7 +2075,7 @@ _git_send_email ()
20792075
--smtp-server-port --smtp-encryption= --smtp-user
20802076
--subject --suppress-cc= --suppress-from --thread --to
20812077
--validate --no-validate
2082-
$__git_format_patch_options"
2078+
$__git_format_patch_extra_options"
20832079
return
20842080
;;
20852081
esac

git-send-email.perl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ sub usage {
122122
exit(1);
123123
}
124124

125+
sub completion_helper {
126+
print Git::command('format-patch', '--git-completion-helper');
127+
exit(0);
128+
}
129+
125130
# most mail servers generate the Date: header, but not all...
126131
sub format_2822_time {
127132
my ($time) = @_;
@@ -314,6 +319,7 @@ sub signal_handler {
314319
# needing, first, from the command line:
315320

316321
my $help;
322+
my $git_completion_helper;
317323
my $rc = GetOptions("h" => \$help,
318324
"dump-aliases" => \$dump_aliases);
319325
usage() unless $rc;
@@ -377,9 +383,11 @@ sub signal_handler {
377383
"no-xmailer" => sub {$use_xmailer = 0},
378384
"batch-size=i" => \$batch_size,
379385
"relogin-delay=i" => \$relogin_delay,
386+
"git-completion-helper" => \$git_completion_helper,
380387
);
381388

382389
usage() if $help;
390+
completion_helper() if $git_completion_helper;
383391
unless ($rc) {
384392
usage();
385393
}

0 commit comments

Comments
 (0)