diff options
author | Drew DeVault <sir@cmpwn.com> | 2020-07-24 03:44:32 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-07-24 04:00:34 +0300 |
commit | dd84e528a34c3822e7ab0473a95e411665b37681 (patch) | |
tree | 92ec8f5e78e1aeac2be748dcf0262a370cc228cb /perl/Git.pm | |
parent | 3d20111cbd42c9ef3116bb629838bcbfea508cda (diff) |
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 <sir@cmpwn.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'perl/Git.pm')
-rw-r--r-- | perl/Git.pm | 26 |
1 files changed, 26 insertions, 0 deletions
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<RE>. 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 { |