diff options
author | Thomas Rast <trast@student.ethz.ch> | 2009-06-08 23:34:12 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-09-08 09:11:15 -0700 |
commit | a03bc5b6ad4ada4eb0669289429a9bc21ff6cdb0 (patch) | |
tree | 15903482a90fc4f8a1e773c491d995f223b8ee23 /git-send-email.perl | |
parent | 04df568be53c42d07aea393effc7c5653f245d9a (diff) | |
download | git-a03bc5b6ad4ada4eb0669289429a9bc21ff6cdb0.tar.gz |
send-email: Refuse to send cover-letter template subject
Every so often, someone sends out an unedited cover-letter template.
Add a simple check to send-email that refuses to send if the subject
contains "*** SUBJECT HERE ***", with an option --force to override.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-send-email.perl')
-rwxr-xr-x | git-send-email.perl | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/git-send-email.perl b/git-send-email.perl index 6dab3bf6a7..bfb6a36344 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -85,6 +85,7 @@ git send-email [options] <file | directory | rev-list options > --[no-]validate * Perform patch sanity checks. Default on. --[no-]format-patch * understand any non optional arguments as `git format-patch` ones. + --force * Send even if safety checks would prevent it. EOT exit(1); @@ -162,6 +163,7 @@ if ($@) { my ($quiet, $dry_run) = (0, 0); my $format_patch; my $compose_filename; +my $force = 0; # Handle interactive edition of files. my $multiedit; @@ -301,6 +303,7 @@ my $rc = GetOptions("sender|from=s" => \$sender, "validate!" => \$validate, "format-patch!" => \$format_patch, "8bit-encoding=s" => \$auto_8bit_encoding, + "force" => \$force, ); unless ($rc) { @@ -702,6 +705,16 @@ if (!defined $auto_8bit_encoding && scalar %broken_encoding) { default => "UTF-8"); } +if (!$force) { + for my $f (@files) { + if (get_patch_subject($f) =~ /\*\*\* SUBJECT HERE \*\*\*/) { + die "Refusing to send because the patch\n\t$f\n" + . "has the template subject '*** SUBJECT HERE ***'. " + . "Pass --force if you really want to send.\n"; + } + } +} + my $prompting = 0; if (!defined $sender) { $sender = $repoauthor || $repocommitter || ''; |