summaryrefslogtreecommitdiff
path: root/perl
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2020-07-24 00:44:32 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-07-24 01:00:34 (GMT)
commitdd84e528a34c3822e7ab0473a95e411665b37681 (patch)
tree92ec8f5e78e1aeac2be748dcf0262a370cc228cb /perl
parent3d20111cbd42c9ef3116bb629838bcbfea508cda (diff)
downloadgit-dd84e528a34c3822e7ab0473a95e411665b37681.zip
git-dd84e528a34c3822e7ab0473a95e411665b37681.tar.gz
git-dd84e528a34c3822e7ab0473a95e411665b37681.tar.bz2
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')
-rw-r--r--perl/Git.pm26
1 files changed, 26 insertions, 0 deletions
diff --git a/perl/Git.pm b/perl/Git.pm
index 54c9ed0..10df990 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 {