summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-10-12 13:51:44 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-10-12 13:51:44 -0700
commit1af632444bb837cfccfec5b3d2e5fc935fde0fa7 (patch)
treedfa40ce2e036fc9e4b33927cce402bf23f7bbb75
parentMerge branch 'so/diff-index-regression-fix' into maint (diff)
parentsend-email: fix a "first config key wins" regression in v2.33.0 (diff)
downloadtgif-1af632444bb837cfccfec5b3d2e5fc935fde0fa7.tar.xz
Merge branch 'ab/send-email-config-fix' into maint
Regression fix. * ab/send-email-config-fix: send-email: fix a "first config key wins" regression in v2.33.0
-rwxr-xr-xgit-send-email.perl2
-rwxr-xr-xt/t9001-send-email.sh15
2 files changed, 16 insertions, 1 deletions
diff --git a/git-send-email.perl b/git-send-email.perl
index fd79849530..5262d88ee3 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -376,7 +376,7 @@ sub read_config {
@$target = @values;
}
else {
- my $v = $known_keys->{$key}->[0];
+ my $v = $known_keys->{$key}->[-1];
next unless defined $v;
next if $configured->{$setting}++;
$$target = $v;
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 9022074474..aa0c20499b 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -1533,6 +1533,21 @@ test_expect_success $PREREQ 'sendemail.8bitEncoding works' '
test_cmp content-type-decl actual
'
+test_expect_success $PREREQ 'sendemail.8bitEncoding in .git/config overrides --global .gitconfig' '
+ clean_fake_sendmail &&
+ git config sendemail.assume8bitEncoding UTF-8 &&
+ test_when_finished "rm -rf home" &&
+ mkdir home &&
+ git config -f home/.gitconfig sendemail.assume8bitEncoding "bogus too" &&
+ echo bogus |
+ env HOME="$(pwd)/home" DEBUG=1 \
+ git send-email --from=author@example.com --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ email-using-8bit >stdout &&
+ egrep "Content|MIME" msgtxt1 >actual &&
+ test_cmp content-type-decl actual
+'
+
test_expect_success $PREREQ '--8bit-encoding overrides sendemail.8bitEncoding' '
clean_fake_sendmail &&
git config sendemail.assume8bitEncoding "bogus too" &&