Preserve releases sandwiched between non-consecutive skip_tags matches - #1602
Preserve releases sandwiched between non-consecutive skip_tags matches#1602YuriNachos wants to merge 1 commit into
Conversation
When git.skip_tags matched a release, the code mutated the shared older release's previous pointer (set it to None) to repoint the skipped release. For a release sandwiched between two non-consecutive skip matches, this corrupted the shared release's own chain, dropping it from the changelog. Clone the previous release so the detached snapshot carries no stale chain while the shared older release is left untouched.
|
Thanks for opening this pull request! Please check out our contributing guidelines! ⛰️ |
|
Note on the red checks, so they don't read as a problem with this branch:
This PR touches exactly one file,
Neither is fixable from this branch. Happy to open a separate PR for the macports link if that's useful. |
|
Wanted to check back on this one — the red |
Summary
A release sandwiched between two non-consecutive
git.skip_tagsmatches is no longer dropped from the changelog. More generally, the chain of any release used as a repoint target is preserved.Root cause
When
skip_tagsmatched a release, the code usedget_mutto repoint the skipped release at the next-older kept release, then setprevious = Noneon that shared older release in place. For a release sitting between two non-consecutive skip matches, this corrupted the shared release's ownpreviouschain, dropping it. The same flaw nullled the chain of any release used as a repoint target, which also affected downstream readers ofrelease.previous(statisticsdays_passed_since_last_release,calculate_next_version).Changes
git-cliff-core/src/changelog.rs— clone the previous release (get(...).cloned()) so settingprevious = Noneon the detached snapshot leaves the shared older release untouched. Same single clone as before, no perf change.changelog_generator_skip_tags_keeps_sandwiched_release, 5 cases) — proves red→green for the sandwich case and the single-skip-with-kept-target case; consecutive/no-match cases are regression guards.Test plan
cargo testcases — two fail on the oldget_mutcode (chain corrupted toNone), pass after the clone fix.This change was developed with AI assistance (Claude Code); every changed line was reviewed and understood.