Skip to content

Preserve releases sandwiched between non-consecutive skip_tags matches - #1602

Open
YuriNachos wants to merge 1 commit into
orhun:mainfrom
YuriNachos:YuriNachos/w5-gitcliff-skiptags
Open

Preserve releases sandwiched between non-consecutive skip_tags matches#1602
YuriNachos wants to merge 1 commit into
orhun:mainfrom
YuriNachos:YuriNachos/w5-gitcliff-skiptags

Conversation

@YuriNachos

Copy link
Copy Markdown

Summary

A release sandwiched between two non-consecutive git.skip_tags matches 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_tags matched a release, the code used get_mut to repoint the skipped release at the next-older kept release, then set previous = None on that shared older release in place. For a release sitting between two non-consecutive skip matches, this corrupted the shared release's own previous chain, dropping it. The same flaw nullled the chain of any release used as a repoint target, which also affected downstream readers of release.previous (statistics days_passed_since_last_release, calculate_next_version).

Changes

  • git-cliff-core/src/changelog.rs — clone the previous release (get(...).cloned()) so setting previous = None on the detached snapshot leaves the shared older release untouched. Same single clone as before, no perf change.
  • Inline table test (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

  • Inline cargo test cases — two fail on the old get_mut code (chain corrupted to None), pass after the clone fix.

This change was developed with AI assistance (Claude Code); every changed line was reviewed and understood.

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.
@YuriNachos
YuriNachos requested a review from orhun as a code owner August 9, 2026 03:34
@welcome

welcome Bot commented Aug 9, 2026

Copy link
Copy Markdown

Thanks for opening this pull request! Please check out our contributing guidelines! ⛰️

@YuriNachos

Copy link
Copy Markdown
Author

Note on the red checks, so they don't read as a problem with this branch:

Links — the failure is a broken link in website/docs/installation/macports.md:

🚫 Errors      | 1
### Errors in website/docs/installation/macports.md

This PR touches exactly one file, git-cliff-core/src/changelog.rs. It adds no links and no docs. The same workflow is red on main itself — the three most recent main runs (2026-08-09, 2026-08-04, 2026-08-02) all conclude failure.

Test suite — same story as #1600: the Rust tests themselves pass; the job exits non-zero on the codecov upload step, which cannot authenticate from a fork.

Neither is fixable from this branch. Happy to open a separate PR for the macports link if that's useful.

@YuriNachos

Copy link
Copy Markdown
Author

Wanted to check back on this one — the red Links check is a pre-existing website issue (details in my comment above), and the rest of the CI is green. Is there anything you'd like changed in the implementation or the tests before it can be reviewed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant