From: Eric Wong Date: Fri, 10 Jan 2025 23:18:12 +0000 (+0000) Subject: smsg->populate: rename $sync to $cmt_info X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=efe0e5203571c56e95d9f43e02c1f1b8ed94d6f4;p=thirdparty%2Fpublic-inbox.git smsg->populate: rename $sync to $cmt_info 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. --- diff --git a/lib/PublicInbox/Smsg.pm b/lib/PublicInbox/Smsg.pm index b132381b4..a430f72b9 100644 --- a/lib/PublicInbox/Smsg.pm +++ b/lib/PublicInbox/Smsg.pm @@ -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 diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index e5dae5485..5d8a5484b 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -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); }