git-send-email.perl: support no- prefix with older GetOptions
Only Perl version 5.8.0 or later is required, but that comes with an older Getopt::Long (2.32) that does not support the 'no-' prefix. Support for that was added in Getopt::Long version 2.33. Since the help only mentions the 'no-' prefix and not the 'no' prefix, add explicit support for the 'no-' prefix to support older GetOptions versions. Reported-by: Tom G. Christensen <tgc@statsbiblioteket.dk> Signed-off-by: Kyle J. McKay <mackyle@gmail.com> Tested-by: Tom G. Christensen <tgc@statsbiblioteket.dk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Kyle J. McKay committed
Jan 30, 2015 at 18:40 UTC
f471494303c2d2a085f384eac705379ef2423590
2 files changed
+15
-5
git-send-email.perl
+10
@@ -299,6 +299,7 @@ my $rc = GetOptions("h" => \$help,
299
"bcc=s" => \@bcclist,
300
"no-bcc" => \$no_bcc,
301
"chain-reply-to!" => \$chain_reply_to,
302
+ "no-chain-reply-to" => sub {$chain_reply_to = 0},
303
"smtp-server=s" => \$smtp_server,
304
"smtp-server-option=s" => \@smtp_server_options,
305
"smtp-server-port=s" => \$smtp_server_port,
@@ -311,25 +312,34 @@ my $rc = GetOptions("h" => \$help,
312
"smtp-domain:s" => \$smtp_domain,
313
"identity=s" => \$identity,
314
"annotate!" => \$annotate,
315
+ "no-annotate" => sub {$annotate = 0},
316
"compose" => \$compose,
317
"quiet" => \$quiet,
318
"cc-cmd=s" => \$cc_cmd,
319
"suppress-from!" => \$suppress_from,
320
+ "no-suppress-from" => sub {$suppress_from = 0},
321
"suppress-cc=s" => \@suppress_cc,
322
"signed-off-cc|signed-off-by-cc!" => \$signed_off_by_cc,
323
+ "no-signed-off-cc|no-signed-off-by-cc" => sub {$signed_off_by_cc = 0},
324
"cc-cover|cc-cover!" => \$cover_cc,
325
+ "no-cc-cover" => sub {$cover_cc = 0},
326
"to-cover|to-cover!" => \$cover_to,
327
+ "no-to-cover" => sub {$cover_to = 0},
328
"confirm=s" => \$confirm,
329
"dry-run" => \$dry_run,
330
"envelope-sender=s" => \$envelope_sender,
331
"thread!" => \$thread,
332
+ "no-thread" => sub {$thread = 0},
333
"validate!" => \$validate,
334
+ "no-validate" => sub {$validate = 0},
335
"transfer-encoding=s" => \$target_xfer_encoding,
336
"format-patch!" => \$format_patch,
337
+ "no-format-patch" => sub {$format_patch = 0},
338
"8bit-encoding=s" => \$auto_8bit_encoding,
339
"compose-encoding=s" => \$compose_encoding,
340
"force" => \$force,
341
"xmailer!" => \$use_xmailer,
342
+ "no-xmailer" => sub {$use_xmailer = 0},
343
);
344
345
usage() if $help;
t/t9001-send-email.sh
+5
-5
@@ -392,7 +392,7 @@ test_expect_success $PREREQ 'allow long lines with --no-validate' '
392
--from="Example <nobody@example.com>" \
393
--to=nobody@example.com \
394
--smtp-server="$(pwd)/fake.sendmail" \
395
- --novalidate \
395
+ --no-validate \
396
$patches longline.patch \
397
2>errors
398
'
@@ -426,7 +426,7 @@ test_expect_success $PREREQ 'In-Reply-To without --chain-reply-to' '
426
git send-email \
427
--from="Example <nobody@example.com>" \
428
--to=nobody@example.com \
429
- --nochain-reply-to \
429
+ --no-chain-reply-to \
430
--in-reply-to="$(cat expect)" \
431
--smtp-server="$(pwd)/fake.sendmail" \
432
$patches $patches $patches \
@@ -1067,7 +1067,7 @@ test_expect_success $PREREQ 'in-reply-to but no threading' '
1067
--from="Example <nobody@example.com>" \
1068
--to=nobody@example.com \
1069
--in-reply-to="<in-reply-id@example.com>" \
1070
- --nothread \
1070
+ --no-thread \
1071
$patches |
1072
grep "In-Reply-To: <in-reply-id@example.com>"
1073
'
@@ -1077,7 +1077,7 @@ test_expect_success $PREREQ 'no in-reply-to and no threading' '
1077
--dry-run \
1078
--from="Example <nobody@example.com>" \
1079
--to=nobody@example.com \
1080
- --nothread \
1080
+ --no-thread \
1081
$patches $patches >stdout &&
1082
! grep "In-Reply-To: " stdout
1083
'
@@ -1088,7 +1088,7 @@ test_expect_success $PREREQ 'threading but no chain-reply-to' '
1088
--from="Example <nobody@example.com>" \
1089
--to=nobody@example.com \
1090
--thread \
1091
- --nochain-reply-to \
1091
+ --no-chain-reply-to \
1092
$patches $patches >stdout &&
1093
grep "In-Reply-To: " stdout
1094
'