summaryrefslogtreecommitdiff
path: root/git-send-email.perl
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-12-04 11:19:10 -0800
committerJunio C Hamano <gitster@pobox.com>2015-12-04 11:19:11 -0800
commitc69d08df96ab784a61c9abaf81a632eea594e62b (patch)
tree1eeda2fbd27ef396abdddb248f167bafa0b56cb7 /git-send-email.perl
parent2e5adec97a65ce8c2c803b9e1cbb1c0d067e7e47 (diff)
parentdfbe5eeb321c4887328f134afe09e98dc722a365 (diff)
downloadgit-c69d08df96ab784a61c9abaf81a632eea594e62b.tar.gz
Merge branch 'jk/send-email-complete-aliases'
Teach send-email to dump mail aliases, so that we can do tab completion on the command line. * jk/send-email-complete-aliases: completion: add support for completing email aliases sendemail: teach git-send-email to dump alias names
Diffstat (limited to 'git-send-email.perl')
-rwxr-xr-xgit-send-email.perl15
1 files changed, 15 insertions, 0 deletions
diff --git a/git-send-email.perl b/git-send-email.perl
index 77cc2cc371..2a3873b744 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -46,6 +46,7 @@ package main;
sub usage {
print <<EOT;
git send-email [options] <file | directory | rev-list options >
+git send-email --dump-aliases
Composing:
--from <str> * Email From:
@@ -101,6 +102,9 @@ git send-email [options] <file | directory | rev-list options >
`git format-patch` ones.
--force * Send even if safety checks would prevent it.
+ Information:
+ --dump-aliases * Dump configured aliases and exit.
+
EOT
exit(1);
}
@@ -180,6 +184,7 @@ my ($quiet, $dry_run) = (0, 0);
my $format_patch;
my $compose_filename;
my $force = 0;
+my $dump_aliases = 0;
# Handle interactive edition of files.
my $multiedit;
@@ -291,6 +296,11 @@ $SIG{INT} = \&signal_handler;
my $help;
my $rc = GetOptions("h" => \$help,
+ "dump-aliases" => \$dump_aliases);
+usage() unless $rc;
+die "--dump-aliases incompatible with other options\n"
+ if !$help and $dump_aliases and @ARGV;
+$rc = GetOptions(
"sender|from=s" => \$sender,
"in-reply-to=s" => \$initial_reply_to,
"subject=s" => \$initial_subject,
@@ -551,6 +561,11 @@ if (@alias_files and $aliasfiletype and defined $parse_alias{$aliasfiletype}) {
}
}
+if ($dump_aliases) {
+ print "$_\n" for (sort keys %aliases);
+ exit(0);
+}
+
# is_format_patch_arg($f) returns 0 if $f names a patch, or 1 if
# $f is a revision list specification to be passed to format-patch.
sub is_format_patch_arg {