From dd84e528a34c3822e7ab0473a95e411665b37681 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 23 Jul 2020 20:44:32 -0400 Subject: git-send-email: die if sendmail.* config is set I've seen several people mis-configure git send-email on their first attempt because they set the sendmail.* config options - not sendemail.*. This patch detects this mistake and bails out with a friendly warning. Signed-off-by: Drew DeVault Signed-off-by: Junio C Hamano --- perl/Git.pm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'perl') diff --git a/perl/Git.pm b/perl/Git.pm index 54c9ed0dde..10df990959 100644 --- a/perl/Git.pm +++ b/perl/Git.pm @@ -723,6 +723,32 @@ sub config_int { return scalar _config_common({'kind' => '--int'}, @_); } +=item config_regexp ( RE ) + +Retrieve the list of configuration key names matching the regular +expression C. The return value is a list of strings matching +this regex. + +=cut + +sub config_regexp { + my ($self, $regex) = _maybe_self(@_); + try { + my @cmd = ('config', '--name-only', '--get-regexp', $regex); + unshift @cmd, $self if $self; + my @matches = command(@cmd); + return @matches; + } catch Git::Error::Command with { + my $E = shift; + if ($E->value() == 1) { + my @matches = (); + return @matches; + } else { + throw $E; + } + }; +} + # Common subroutine to implement bulk of what the config* family of methods # do. This currently wraps command('config') so it is not so fast. sub _config_common { -- cgit v1.2.1