fix(gerrit): improve commit message vs pr title workaround #32115
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
This improves the workaround for the Gerrit change title mismatch issue.
The previous approach had big downsides:
It would create new patchsets every time the commit message title did not match with the prTitle
Image:
If Renovate for whatever reason fails before updating the commit message to match the PR title, it would mean that the change would be forgot by Renovate forever, and Renovate would attempt to create a new one next time. Also, if this happens and someone closes the change (to ignore future updates), Renovate will also never realize that the change was closed and will keep trying to create a new one.
The new approach will always ensure the commit is created or recreated with the proper title. In this case, none of the downsides above will happen. Also, it cleans the code a little, removing gimmicks no longer necessary.
I understand this fix touches a bit of code outside of the Gerrit platform, but I believe it is better enough to at least justify it being merged (when compared to the current approach). If a better approach is found in the future, we can always refactor it.
With this fix, I also believe that the user doesn't even need to be aware of how this is handled. Previously, maybe the user would notice the second patchset and thus the documentation would explain this behavior. Now, the user will never notice this behavior to begin with. Obviously, I'm open to suggestions.
Context
See above.
Documentation (please check one with an [x])
How I've tested my work (please select one)
I have verified these changes via: