mirror of
https://github.com/git/git.git
synced 2024-05-05 21:06:11 +02:00
send-email: copy "config_regxp" into git-send-email.perl
The config_regexp() function was added in dd84e528a3
(git-send-email:
die if sendmail.* config is set, 2020-07-23) for use in
git-send-email, and it's the only in-tree user of it.
However, the consensus is that Git.pm is a public interface, so even
though it's a recently added function we can't change it. So let's
copy over a minimal version of it to git-send-email.perl itself. In a
subsequent commit it'll be changed further for our own use.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
119974e9e7
commit
2b110e9ba2
|
@ -390,6 +390,24 @@ sub read_config {
|
|||
}
|
||||
}
|
||||
|
||||
sub config_regexp {
|
||||
my ($regex) = @_;
|
||||
my @ret;
|
||||
eval {
|
||||
@ret = Git::command(
|
||||
'config',
|
||||
'--name-only',
|
||||
'--get-regexp',
|
||||
$regex,
|
||||
);
|
||||
1;
|
||||
} or do {
|
||||
# If we have no keys we're OK, otherwise re-throw
|
||||
die $@ if $@->value != 1;
|
||||
};
|
||||
return @ret;
|
||||
}
|
||||
|
||||
# sendemail.identity yields to --identity. We must parse this
|
||||
# special-case first before the rest of the config is read.
|
||||
$identity = Git::config(@repo, "sendemail.identity");
|
||||
|
@ -488,7 +506,7 @@ sub read_config {
|
|||
usage();
|
||||
}
|
||||
|
||||
if ($forbid_sendmail_variables && (scalar Git::config_regexp("^sendmail[.]")) != 0) {
|
||||
if ($forbid_sendmail_variables && (scalar config_regexp("^sendmail[.]")) != 0) {
|
||||
die __("fatal: found configuration options for 'sendmail'\n" .
|
||||
"git-send-email is configured with the sendemail.* options - note the 'e'.\n" .
|
||||
"Set sendemail.forbidSendmailVariables to false to disable this check.\n");
|
||||
|
|
Loading…
Reference in New Issue