Re: [PATCH v2 2/6] shortlog: make trailer insertion a noop when appropriate
- From
Jeff King <peff@peff.net>
- Date
- Oct 21, 2022, 05:38 UTC
- Message-ID
- <Y1IwVIoVsl1FVklI@coredump.intra.peff.net>
- In-Reply-To
- <7decccad7ccb39eed67bab87ed665beccf5d392f.1666320509.git.me@ttaylorr.com>
On Thu, Oct 20, 2022 at 11:11:32PM -0400, Taylor Blau wrote:
Show 10 quoted lines
> When there are no trailers to insert, it is natural that > insert_records_from_trailers() should return without having done any > work. > > But instead we guard this call unnecessarily by first checking whether > `log->groups` has the `SHORTLOG_GROUP_TRAILER` bit set. > > Prepare to match a similar pattern in the future where a function which > inserts records of a certain type does no work when no specifiers > matching that type are given.
The patch looks good. And knowing what the rest of the series looks like, this is clearly the right thing to do. But I wonder if the rationale would be easier if it came at the end. Then rather than "prepare to match a similar pattern in the future", you can just say "it's weird that we check the bit for SHORTLOG_GROUP_TRAILER but nothing else; let's make them consistent".
Obviously this is a minor nit, and I don't care much either way, as the end result is the same. I just think in general that "this is bad, let's make it better" makes commit messages easier to write than ones which posit some hypothetical future state. ;)
-Peff