]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
smsg->populate: rename $sync to $cmt_info
authorEric Wong <e@80x24.org>
Fri, 10 Jan 2025 23:18:12 +0000 (23:18 +0000)
committerEric Wong <e@80x24.org>
Tue, 14 Jan 2025 04:45:29 +0000 (04:45 +0000)
We only use this hashref to propagate author and commit time
from the commit, so give it a more descriptive name rather than
overloading the to-be-eliminated `$sync' struct.  There's no
need to explicitly vivify into a hashref, either.

lib/PublicInbox/Smsg.pm
lib/PublicInbox/V2Writable.pm

index b132381b4ab2c3a93fd78b1fe042d1710a2c3fe8..a430f72b937a8c3506d56278692fb70d3bc690dd 100644 (file)
@@ -90,7 +90,7 @@ sub parse_references ($$$) {
 
 # used for v2, Import and v1 non-SQLite WWW code paths
 sub populate {
-       my ($self, $hdr, $sync) = @_;
+       my ($self, $hdr, $cmt_info) = @_;
        for my $f (qw(From To Cc Subject)) {
                my @all = $hdr->header($f);
                my $val = join(', ', @all);
@@ -111,9 +111,8 @@ sub populate {
                }
                $self->{$f} = $val if $val ne '';
        }
-       $sync //= {};
-       my @ds = msg_datestamp($hdr, $sync->{autime} // $self->{ds});
-       my @ts = msg_timestamp($hdr, $sync->{cotime} // $self->{ts});
+       my @ds = msg_datestamp($hdr, $cmt_info->{autime} // $self->{ds});
+       my @ts = msg_timestamp($hdr, $cmt_info->{cotime} // $self->{ts});
        $self->{-ds} = \@ds;
        $self->{-ts} = \@ts;
        $self->{ds} //= $ds[0]; # no zone
index e5dae5485b871a364a0e5a9749f396faba7a149c..5d8a5484be6c972610fa3c85cbf0cfa401c737fa 100644 (file)
@@ -487,8 +487,8 @@ W: $list
                        num => $smsg->{num},
                        mid => $smsg->{mid},
                }, 'PublicInbox::Smsg';
-               my $sync = { autime => $smsg->{ds}, cotime => $smsg->{ts} };
-               $new_smsg->populate($new_mime, $sync);
+               my $cmt_info = { autime => $smsg->{ds}, cotime => $smsg->{ts} };
+               $new_smsg->populate($new_mime, $cmt_info);
                $new_smsg->set_bytes($raw, $bytes);
                do_idx($self, $new_mime, $new_smsg);
        }