Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-05-19 19:27:06 +0300
committerJunio C Hamano <gitster@pobox.com>2023-05-19 19:27:06 +0300
commitb04671b638745ecdad70d3f22e9f5032f41fc26d (patch)
tree06830250b0f230e7c1d599aa5e77bed7c48540e7
parent75ab1fa5ab167828da918f19c7aebe5ee7a1b304 (diff)
parent20bd08aefb20168c6c227d2bfd1965761f9201ea (diff)
Merge branch 'jc/send-email-pre-process-fix'
When "git send-email" that uses the validate hook is fed a message without and then with Message-ID, it failed to auto-assign a unique Message-ID to the former and instead reused the Message-ID from the latter, which has been corrected. This was a fix for a recent regression caught before the release, so no need to mention it in the release notes. * jc/send-email-pre-process-fix: t9001: mark the script as no longer leak checker clean send-email: clear the $message_id after validation
-rwxr-xr-xgit-send-email.perl1
-rwxr-xr-xt/t9001-send-email.sh19
2 files changed, 18 insertions, 2 deletions
diff --git a/git-send-email.perl b/git-send-email.perl
index 89d8237e89..affbb88509 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1788,6 +1788,7 @@ sub pre_process_file {
$subject = $initial_subject;
$message = "";
$message_num++;
+ undef $message_id;
# Retrieve and unfold header fields.
my @header_lines = ();
while(<$fh>) {
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index b77726c320..22fc908024 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -4,7 +4,7 @@ test_description='git send-email'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
+# no longer TEST_PASSES_SANITIZE_LEAK=true - format-patch --thread leaks
. ./test-lib.sh
# May be altered later in the test
@@ -47,7 +47,7 @@ clean_fake_sendmail () {
test_expect_success $PREREQ 'Extract patches' '
patches=$(git format-patch -s --cc="One <one@example.com>" --cc=two@example.com -n HEAD^1) &&
- threaded_patches=$(git format-patch -o threaded -s --in-reply-to="format" HEAD^1)
+ threaded_patches=$(git format-patch -o threaded --thread=shallow -s --in-reply-to="format" HEAD^1)
'
# Test no confirm early to ensure remaining tests will not hang
@@ -655,6 +655,21 @@ test_expect_success $PREREQ "--validate hook supports header argument" '
outdir/000?-*.patch
'
+test_expect_success $PREREQ 'clear message-id before parsing a new message' '
+ clean_fake_sendmail &&
+ echo true | write_script my-hooks/sendemail-validate &&
+ test_config core.hooksPath my-hooks &&
+ GIT_SEND_EMAIL_NOTTY=1 \
+ git send-email --validate --to=recipient@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ $patches $threaded_patches &&
+ id0=$(grep "^Message-ID: " $threaded_patches) &&
+ id1=$(grep "^Message-ID: " msgtxt1) &&
+ id2=$(grep "^Message-ID: " msgtxt2) &&
+ test "z$id0" = "z$id2" &&
+ test "z$id1" != "z$id2"
+'
+
for enc in 7bit 8bit quoted-printable base64
do
test_expect_success $PREREQ "--transfer-encoding=$enc produces correct header" '