Fix git-send-email.perl w.r.t. recent Getopt::Long update

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Patch attached

From the Getopt::Long changes:
```
Changes in version 2.55
-----------------------
* Fix long standing bug that duplicate options were not detected when
  the options differ in case while ignore_case is in effect.
  This will now yield a warning and become a fatal error in a future
  release.
```

Current version is 2.57


```
git-2.43.0 🐧 perl -Iperl git-send-email.perl --help
Duplicate specification "cc-cover|cc-cover!" for option "cc-cover"
Duplicate specification "no-cc-cover" for option "no-cc-cover"
Duplicate specification "to-cover|to-cover!" for option "to-cover"
Duplicate specification "no-annotate" for option "no-annotate"
Duplicate specification "no-format-patch" for option "no-format-patch"
Duplicate specification "no-signed-off-cc|no-signed-off-by-cc" for option "no-signed-off-cc"
Duplicate specification "no-signed-off-cc|no-signed-off-by-cc" for option "no-signed-off-by-cc"
Duplicate specification "no-validate" for option "no-validate"
Duplicate specification "no-chain-reply-to" for option "no-chain-reply-to"
```

`"option!" => \$value`

*automatically* supports both `--option` and `--no-option` and `--nooption`

See the docs for Getopt::Long:
```
 The argument specification can be

 !   The option does not take an argument and may be negated by
     prefixing it with "no" or "no-". E.g. "foo!" will allow "--foo" (a
     value of 1 will be assigned) as well as "--nofoo" and "--no-foo" (a
     value of 0 will be assigned). If the option has aliases, this
     applies to the aliases as well.

     Using negation on a single letter option when bundling is in effect
     is pointless and will result in a warning.
```


-- 
H.Merijn Brand  https://tux.nl   Perl Monger   http://amsterdam.pm.org/
using perl5.00307 .. 5.37        porting perl5 on HP-UX, AIX, and Linux
https://tux.nl/email.html http://qa.perl.org https://www.test-smoke.org
                           
From 206ace60f7045e309e506a1b9de775f4e9a43b46 Mon Sep 17 00:00:00 2001
From: "H.Merijn Brand - Tux" <linux@xxxxxxxxxxxxxx>
Date: Fri, 24 Nov 2023 10:27:35 +0100
Subject: [PATCH] perl Getopt::Long now issues warnings for duplicate options

$ perl -Iperl git-send-email.perl.org --help
Duplicate specification "no-validate" for option "no-validate"
Duplicate specification "to-cover|to-cover!" for option "to-cover"
Duplicate specification "no-signed-off-cc|no-signed-off-by-cc" for option "no-signed-off-cc"
Duplicate specification "no-signed-off-cc|no-signed-off-by-cc" for option "no-signed-off-by-cc"
Duplicate specification "no-format-patch" for option "no-format-patch"
Duplicate specification "cc-cover|cc-cover!" for option "cc-cover"
Duplicate specification "no-annotate" for option "no-annotate"
Duplicate specification "no-chain-reply-to" for option "no-chain-reply-to"
Duplicate specification "no-cc-cover" for option "no-cc-cover"

"option!" => \$value

*automatically* supports both --option and --no-option and --nooption

 The argument specification can be

 !   The option does not take an argument and may be negated by
     prefixing it with "no" or "no-". E.g. "foo!" will allow "--foo" (a
     value of 1 will be assigned) as well as "--nofoo" and "--no-foo" (a
     value of 0 will be assigned). If the option has aliases, this
     applies to the aliases as well.

     Using negation on a single letter option when bundling is in effect
     is pointless and will result in a warning.

Signed-off-by: H.Merijn Brand - Tux <linux@xxxxxxxxxxxxxx>
---
 git-send-email.perl | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index d24e981d61..125f49cd08 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -491,7 +491,6 @@ sub config_regexp {
 		    "bcc=s" => \@getopt_bcc,
 		    "no-bcc" => \$no_bcc,
 		    "chain-reply-to!" => \$chain_reply_to,
-		    "no-chain-reply-to" => sub {$chain_reply_to = 0},
 		    "sendmail-cmd=s" => \$sendmail_cmd,
 		    "smtp-server=s" => \$smtp_server,
 		    "smtp-server-option=s" => \@smtp_server_options,
@@ -506,36 +505,27 @@ sub config_regexp {
 		    "smtp-auth=s" => \$smtp_auth,
 		    "no-smtp-auth" => sub {$smtp_auth = 'none'},
 		    "annotate!" => \$annotate,
-		    "no-annotate" => sub {$annotate = 0},
 		    "compose" => \$compose,
 		    "quiet" => \$quiet,
 		    "cc-cmd=s" => \$cc_cmd,
 		    "header-cmd=s" => \$header_cmd,
 		    "no-header-cmd" => \$no_header_cmd,
 		    "suppress-from!" => \$suppress_from,
-		    "no-suppress-from" => sub {$suppress_from = 0},
 		    "suppress-cc=s" => \@suppress_cc,
 		    "signed-off-cc|signed-off-by-cc!" => \$signed_off_by_cc,
-		    "no-signed-off-cc|no-signed-off-by-cc" => sub {$signed_off_by_cc = 0},
-		    "cc-cover|cc-cover!" => \$cover_cc,
-		    "no-cc-cover" => sub {$cover_cc = 0},
-		    "to-cover|to-cover!" => \$cover_to,
-		    "no-to-cover" => sub {$cover_to = 0},
+		    "cc-cover!" => \$cover_cc,
+		    "to-cover!" => \$cover_to,
 		    "confirm=s" => \$confirm,
 		    "dry-run" => \$dry_run,
 		    "envelope-sender=s" => \$envelope_sender,
 		    "thread!" => \$thread,
-		    "no-thread" => sub {$thread = 0},
 		    "validate!" => \$validate,
-		    "no-validate" => sub {$validate = 0},
 		    "transfer-encoding=s" => \$target_xfer_encoding,
 		    "format-patch!" => \$format_patch,
-		    "no-format-patch" => sub {$format_patch = 0},
 		    "8bit-encoding=s" => \$auto_8bit_encoding,
 		    "compose-encoding=s" => \$compose_encoding,
 		    "force" => \$force,
 		    "xmailer!" => \$use_xmailer,
-		    "no-xmailer" => sub {$use_xmailer = 0},
 		    "batch-size=i" => \$batch_size,
 		    "relogin-delay=i" => \$relogin_delay,
 		    "git-completion-helper" => \$git_completion_helper,
-- 
2.42.1

Attachment: pgphtR1pVO8gr.pgp
Description: OpenPGP digital signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux