Fix up issues with default author/message in patcher with squash.
Review Request #14320 — Created Feb. 3, 2025 and submitted
When using the patcher with multiple commits, the messages and author
were getting inappropriately overwritten.The intent here was to set a default author and message, probably
computed from the review request, as a fallback if any individual patch
did not have its own author or message. Unfortunately, if we decided we
had any patches to process, we'd unconditionally overwrite the metadata
for them instead of only doing it for those which were missing
information.This was also setting "[x/n] message" for all the patches even when we
were running in squash mode, which meant that if we were applying
multiple patches but squashing to a single commit, the resulting commit
would have the message "[n/n] message" instead of just "message". I've
changed it so if we're expecting to squash (and we have multiple
commits), we always use the default author/message and throw away the
individual commit messages.This wasn't found when running
rbt patch
in real life for two reasons:
1. When we do a squash, we are currently only fetch the cumulative diff
and apply it as a single patch.
2. We currently don't have any cases where commits on the server side
will be lacking author/message information.This also fixes up an issue in the patch command where we were using
enumerate
when we didn't have to.
Ran unit tests, and fixed up the tests which were now broken.
Summary | ID |
---|---|
10b97c0c4464f77a6557a2f4997442ba105e82bc |