list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: Kyle Meyer <>
Subject: [PATCH] send-email: disable option auto-abbreviation
Date: Wed, 23 Nov 2022 21:00:56 -0500	[thread overview]
Message-ID: <> (raw)

send-email supports specifying format-patch options.  However, some
valid format-patch short options trigger an error because Getopt's
default auto-abbreviation is enabled.  For example, with

  git send-email -v 3 @{u}

the -v is consumed as send-email's --validate, and 3 is passed on to
the format-patch call, leading to

  fatal: ambiguous argument '3': unknown revision or path not in the
  working tree.  [...]

Disable Getopt's auto-abbreviation feature so that such options are
properly relayed to format-patch.  With this change, there is some
risk of breaking external scripts that rely on the abbreviation, but
that is hopefully unlikely given that Git does not advertise support
for auto-abbreviation and most subcommands do not support it.

Signed-off-by: Kyle Meyer <>
 git-send-email.perl   | 2 +-
 t/ | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 5861e99a6e..1e6d5d7677 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -24,7 +24,7 @@
 use Git;
 use Git::I18N;
-Getopt::Long::Configure qw/ pass_through /;
+Getopt::Long::Configure qw/ pass_through no_auto_abbrev /;
 package FakeTerm;
 sub new {
diff --git a/t/ b/t/
index 01c74b8b07..c2ebf19ec6 100755
--- a/t/
+++ b/t/
@@ -2334,6 +2334,12 @@ test_expect_success $PREREQ 'test that send-email works outside a repo' '
+test_expect_success $PREREQ 'send-email relays -v 4' '
+	test_when_finished "rm -f out" &&
+	git send-email --dry-run -v 4 -1 >out &&
+	grep "PATCH v4" out
 test_expect_success $PREREQ 'test that sendmail config is rejected' '
 	test_config sendmail.program sendmail &&
 	test_must_fail git send-email \

base-commit: e7e5c6f715b2de7bea0d39c7d2ba887335b40aa0

             reply	other threads:[~2022-11-24  2:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-24  2:00 Kyle Meyer [this message]
2022-11-25  7:11 ` [PATCH] send-email: disable option auto-abbreviation Junio C Hamano
2022-11-25 17:31   ` Kyle Meyer
2022-11-26 20:21     ` [PATCH v2] send-email: relay '-v N' to format-patch Kyle Meyer
2022-11-27  1:25       ` Junio C Hamano
2022-11-28 12:34         ` Ævar Arnfjörð Bjarmason
2022-11-28  9:41       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).