Repository navigation
fix(version): release a reapplied change whose revert shipped in an earlier release - #1074
Merged
Merged
Conversation
…arlier release A `Reapply "…"` commit (or older git's `Revert "Revert "…""`) whose revert is not in the range is now read as the commit it reapplies. It bumps the version and is listed with its type and breaking note, as the original commit was. The bump and the changelog share the one helper that does this.
Contributor
|
Standing release PR: #1054 · v0.47.1 queued (4 packages) · open 2d 11h 52m · ✅ ready to merge Release Preview — v0.47.0 → v0.48.0
These changes will be added to the release PR (#1054) when merged: Changelogmonorepo 0.47.0 → 0.48.0
After merge — predicted release
Updated automatically by ReleaseKit |
A squash merge appends ' (#N)' to the reapply's title. Also drop a test comment the earlier revert test already makes.
… a reapply by hash One loop peels Revert/Reapply titles and squash-merge (#N) suffixes down to the subject, counting a Reapply as two reverts, so a GitHub-button double revert like `Revert "Revert "X" (#13)" (#15)` and a reapply of a reapply are recognised. A reapply pairs with its revert by the hash it names alone, since a squash merge changes the titles git quotes. Single reverts pair as before.
…s its revert A reapply that survives the revert filter and names its revert has no revert in the range, which is the case to release. One without a 'This reverts commit' line stays a plain entry, as before.
Four git reverts with a release after the third leave 'Reapply "Reapply "X""' alone in the range, which only a multi-layer unwrap reads as X.
resolveReverts drops each commit reverted in the range with its revert and reads a remaining reapply as the commit it reapplies, so the bump and the changelog make one call and can't run the two steps out of order.
2 tasks
A revert now cancels the commit named in its `This reverts commit` line whatever its title, so a squash-merged revert drops with the commit it reverts instead of releasing it. This also keeps a squash-merged revert of a reapply from leaving the reapply to be read as the original change.
A squash of several reverts names several commits, which one hash can't pair, so it keeps the preset's matching instead of cancelling the first named commit and dropping the revert. Also say resolveReverts reads a reapply as its original when its revert isn't in the range, not when it was released.
The changelog attaches each commit's hash and message to the parsed commit, so resolveReverts takes and returns commits, without an accessor or an item wrapper.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Reapplying a change that was reverted in an earlier release gave no version bump, and the changelog listed it as a plain
changedentry. ItsReapply "…"title (or older git'sRevert "Revert "…"") didn't match the preset's header pattern, so it had no type and no breaking note.The bump and the changelog now both read such a reapply as the commit it reapplies, so it bumps and is listed like the original:
Revert "…"andReapply "…"layers and squash-merge(#N)suffixes down to the original subject, counting a Reapply as two reverts. That covers git'sReapply, older git's double revert, GitHub's revert button and squash-merged titles.resolveRevertsdrops each commit reverted in the range with its revert, then reads a remaining reapply that names its revert (This reverts commit …) as the commit it reapplies. The bump and the changelog both call it, so the two can't run out of order.Revert "…"orReapply "…"commit that names one commit in itsThis reverts commit …line pairs with it by that hash alone, since a squash merge changes the titles git quotes. A squash of several reverts, naming several commits, keeps the preset's matching. This changes one behaviour from fix(version): keep a commit that is reverted and re-applied in the same release #1068: a squash-merged revert in the same range as the commit it reverts now cancels it, instead of both being kept and the reverted change released.Not covered: a breaking change declared only in the original commit's
BREAKING CHANGE:footer comes back as non-breaking, since the reapply carries only the title.Closes #1071
Testing
Version-CLI cases in
packages/version/test/integration/reverts.spec.tsforReapply "…", a squash-merged reapply with two suffixes, and a GitHub-button double revert, each with its revert in an earlier release. All bump to 2.0.0 and listdrop Node 18as a breakingaddedentry, and fail without the fix. The squash-merged revert case now expects the revert to cancel its commit, and a squash of several reverts keeps every commit; the other same-range revert cases are unchanged.pnpm lintandpnpm typecheckpass.