]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jc/send-email-pre-process-fix'
authorJunio C Hamano <gitster@pobox.com>
Fri, 19 May 2023 16:27:06 +0000 (09:27 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 19 May 2023 16:27:06 +0000 (09:27 -0700)
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

1  2 
git-send-email.perl
t/t9001-send-email.sh

index 89d8237e89391b4970dd97f8b5c1bbd5321e5e4d,37dfd4b8c57c47624cf1210c84d8e96ebe80a385..affbb88509b83945df90d774401812f3a8b28658
@@@ -1788,16 -1768,18 +1788,17 @@@ sub pre_process_file 
        $subject = $initial_subject;
        $message = "";
        $message_num++;
 -
 -      # First unfold multiline header fields
+       undef $message_id;
 +      # Retrieve and unfold header fields.
 +      my @header_lines = ();
        while(<$fh>) {
                last if /^\s*$/;
 -              if (/^\s+\S/ and @header) {
 -                      chomp($header[$#header]);
 -                      s/^\s+/ /;
 -                      $header[$#header] .= $_;
 -          } else {
 -                      push(@header, $_);
 -              }
 +              push(@header_lines, $_);
 +      }
 +      @header = unfold_headers(@header_lines);
 +      # Add computed headers, if applicable.
 +      unless ($no_header_cmd || ! $header_cmd) {
 +              push @header, invoke_header_cmd($header_cmd, $t);
        }
        # Now parse the header
        foreach(@header) {
Simple merge