Skip to content

Commit 0278b3f

Browse files
committed
Merge branch 'km/send-email-getopt-long-workarounds'
Even though we officially haven't dropped Perl 5.8 support, the Getopt::Long package that came with it does not support "--no-" prefix to negate a boolean option; manually add support to help people with older Getopt::Long package. * km/send-email-getopt-long-workarounds: git-send-email.perl: support no- prefix with older GetOptions
2 parents 73b690a + f471494 commit 0278b3f

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

git-send-email.perl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ sub signal_handler {
299299
"bcc=s" => \@bcclist,
300300
"no-bcc" => \$no_bcc,
301301
"chain-reply-to!" => \$chain_reply_to,
302+
"no-chain-reply-to" => sub {$chain_reply_to = 0},
302303
"smtp-server=s" => \$smtp_server,
303304
"smtp-server-option=s" => \@smtp_server_options,
304305
"smtp-server-port=s" => \$smtp_server_port,
@@ -311,25 +312,34 @@ sub signal_handler {
311312
"smtp-domain:s" => \$smtp_domain,
312313
"identity=s" => \$identity,
313314
"annotate!" => \$annotate,
315+
"no-annotate" => sub {$annotate = 0},
314316
"compose" => \$compose,
315317
"quiet" => \$quiet,
316318
"cc-cmd=s" => \$cc_cmd,
317319
"suppress-from!" => \$suppress_from,
320+
"no-suppress-from" => sub {$suppress_from = 0},
318321
"suppress-cc=s" => \@suppress_cc,
319322
"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},
320324
"cc-cover|cc-cover!" => \$cover_cc,
325+
"no-cc-cover" => sub {$cover_cc = 0},
321326
"to-cover|to-cover!" => \$cover_to,
327+
"no-to-cover" => sub {$cover_to = 0},
322328
"confirm=s" => \$confirm,
323329
"dry-run" => \$dry_run,
324330
"envelope-sender=s" => \$envelope_sender,
325331
"thread!" => \$thread,
332+
"no-thread" => sub {$thread = 0},
326333
"validate!" => \$validate,
334+
"no-validate" => sub {$validate = 0},
327335
"transfer-encoding=s" => \$target_xfer_encoding,
328336
"format-patch!" => \$format_patch,
337+
"no-format-patch" => sub {$format_patch = 0},
329338
"8bit-encoding=s" => \$auto_8bit_encoding,
330339
"compose-encoding=s" => \$compose_encoding,
331340
"force" => \$force,
332341
"xmailer!" => \$use_xmailer,
342+
"no-xmailer" => sub {$use_xmailer = 0},
333343
);
334344

335345
usage() if $help;

t/t9001-send-email.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ test_expect_success $PREREQ 'allow long lines with --no-validate' '
392392
--from="Example <[email protected]>" \
393393
394394
--smtp-server="$(pwd)/fake.sendmail" \
395-
--novalidate \
395+
--no-validate \
396396
$patches longline.patch \
397397
2>errors
398398
'
@@ -426,7 +426,7 @@ test_expect_success $PREREQ 'In-Reply-To without --chain-reply-to' '
426426
git send-email \
427427
--from="Example <[email protected]>" \
428428
429-
--nochain-reply-to \
429+
--no-chain-reply-to \
430430
--in-reply-to="$(cat expect)" \
431431
--smtp-server="$(pwd)/fake.sendmail" \
432432
$patches $patches $patches \
@@ -1067,7 +1067,7 @@ test_expect_success $PREREQ 'in-reply-to but no threading' '
10671067
--from="Example <[email protected]>" \
10681068
10691069
--in-reply-to="<[email protected]>" \
1070-
--nothread \
1070+
--no-thread \
10711071
$patches |
10721072
grep "In-Reply-To: <[email protected]>"
10731073
'
@@ -1077,7 +1077,7 @@ test_expect_success $PREREQ 'no in-reply-to and no threading' '
10771077
--dry-run \
10781078
--from="Example <[email protected]>" \
10791079
1080-
--nothread \
1080+
--no-thread \
10811081
$patches $patches >stdout &&
10821082
! grep "In-Reply-To: " stdout
10831083
'
@@ -1088,7 +1088,7 @@ test_expect_success $PREREQ 'threading but no chain-reply-to' '
10881088
--from="Example <[email protected]>" \
10891089
10901090
--thread \
1091-
--nochain-reply-to \
1091+
--no-chain-reply-to \
10921092
$patches $patches >stdout &&
10931093
grep "In-Reply-To: " stdout
10941094
'

0 commit comments

Comments
 (0)