This v4 fixes an issue in v3 where 12/13 had a "diff --git" as part of the commit message (mistake during rebase/squash), which confused "git am" in trying to apply a diff twice. See <xmqqwnrplyns.fsf@gitster.g>. Ævar Arnfjörð Bjarmason (13): send-email tests: support GIT_TEST_PERL_FATAL_WARNINGS=true send-email tests: test for boolean variables without a value send-email: remove non-working support for "sendemail.smtpssl" send-email: refactor sendemail.smtpencryption config parsing send-email: copy "config_regxp" into git-send-email.perl send-email: lazily load config for a big speedup send-email: lazily shell out to "git var" send-email: use function syntax instead of barewords send-email: get rid of indirect object syntax send-email: lazily load modules for a big speedup perl: lazily load some common Git.pm setup code send-email: move trivial config handling to Perl perl: nano-optimize by replacing Cwd::cwd() with Cwd::getcwd() Documentation/config/sendemail.txt | 3 - git-send-email.perl | 174 +++++++++++++++++++---------- perl/Git.pm | 35 +++--- t/t9001-send-email.sh | 29 +++++ 4 files changed, 160 insertions(+), 81 deletions(-) Range-diff against v3: 1: 71f890dc603 = 1: 7140847367c send-email tests: support GIT_TEST_PERL_FATAL_WARNINGS=true 2: 707c2ca5563 = 2: d27f3b48f85 send-email tests: test for boolean variables without a value 3: 3bbd48dab23 = 3: a7a21b75f2e send-email: remove non-working support for "sendemail.smtpssl" 4: bed0f98d681 = 4: 7356a528589 send-email: refactor sendemail.smtpencryption config parsing 5: c12f69a4110 = 5: cce0f89143b send-email: copy "config_regxp" into git-send-email.perl 6: d1c233d2515 = 6: 8afe8661761 send-email: lazily load config for a big speedup 7: 4326c2f99c1 = 7: 491eefde6a2 send-email: lazily shell out to "git var" 8: e1fc71e3f90 = 8: 860156013f8 send-email: use function syntax instead of barewords 9: a806ce06f18 = 9: dd24f1249f5 send-email: get rid of indirect object syntax 10: aa11439789d = 10: 61e3e3c93c5 send-email: lazily load modules for a big speedup 11: b3b342b173b = 11: ada34374286 perl: lazily load some common Git.pm setup code 12: 950dc0f53dd ! 12: 3818000bfba send-email: move trivial config handling to Perl @@ Commit message Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> - diff --git a/git-send-email.perl b/git-send-email.perl - index 1e9273fd4f..1ea4d9589d 100755 - --- a/git-send-email.perl - +++ b/git-send-email.perl - @@ -324,7 +324,11 @@ sub read_config { - my $target = $config_bool_settings{$setting}; - my $key = "$prefix.$setting"; - next unless exists $known_keys->{$key}; - - my $v = Git::config_bool(@repo, $key); - + my $v = (@{$known_keys->{$key}} == 1 && - + (defined $known_keys->{$key}->[0] && - + $known_keys->{$key}->[0] =~ /^(?:true|false)$/s)) - + ? $known_keys->{$key}->[0] eq 'true' - + : Git::config_bool(@repo, $key); - next unless defined $v; - next if $configured->{$setting}++; - $$target = $v; - @@ -353,14 +357,12 @@ sub read_config { - my $key = "$prefix.$setting"; - next unless exists $known_keys->{$key}; - if (ref($target) eq "ARRAY") { - - my @values = Git::config(@repo, $key); - - next unless @values; - + my @values = @{$known_keys->{$key}}; - next if $configured->{$setting}++; - @$target = @values; - } - else { - - my $v = Git::config(@repo, $key); - - next unless defined $v; - + my $v = $known_keys->{$key}->[0]; - next if $configured->{$setting}++; - $$target = $v; - } - @@ -371,12 +373,19 @@ sub config_regexp { - my ($regex) = @_; - my @ret; - eval { - - @ret = Git::command( - + my $ret = Git::command( - 'config', - - '--name-only', - + '--null', - '--get-regexp', - $regex, - ); - + @ret = map { - + # We must always return ($k, $v) here, since - + # empty config values will be just "key\0", - + # not "key\nvalue\0". - + my ($k, $v) = split /\n/, $_, 2; - + ($k, $v); - + } split /\0/, $ret; - 1; - } or do { - # If we have no keys we're OK, otherwise re-throw - @@ -389,8 +398,10 @@ sub config_regexp { - # parses 'bool' etc.) by only doing so for config keys that exist. - my %known_config_keys; - { - - my @known_config_keys = config_regexp("^sende?mail[.]"); - - @known_config_keys{@known_config_keys} = (); - + my @kv = config_regexp("^sende?mail[.]"); - + while (my ($k, $v) = splice @kv, 0, 2) { - + push @{$known_config_keys{$k}} => $v; - + } - } - - # sendemail.identity yields to --identity. We must parse this - ## git-send-email.perl ## @@ git-send-email.perl: sub read_config { my $target = $config_bool_settings{$setting}; 13: c1d7ea664ac = 13: d36b57e429f perl: nano-optimize by replacing Cwd::cwd() with Cwd::getcwd() -- 2.32.0.rc1.385.g46e826f1e55