git-cliff
git-cliff copied to clipboard
fix: assign commits to closest tag
Description
Previously, when creating releases (assigning commits to tags), a new release was considered only when a tagged commit is encountered. This works fine in most cases, however, when used together with --include-path/--exclude-path, which may filter out one of these tagged commits, the entire tag would be skipped too.
This PR makes sure tags are never skipped by looking up the closest tag instead of trying to find an exact match for a given commit when creating new releases.
Additionally, this PR also fixes the issue where the first (root) commit of the repository was never included in the output when --include-path/--include-path was used.
Both of these issues are described in https://github.com/orhun/git-cliff/issues/208.
Based on https://github.com/orhun/git-cliff/pull/709 to minimize conflicts.
Motivation and Context
Fixes https://github.com/orhun/git-cliff/issues/208.
How Has This Been Tested?
cargo test + manual testing on repositories I use git-cliff on with --include-path, and with the script provided in the issue.
Screenshots / Logs (if applicable)
Types of Changes
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Documentation (no code change)
- [ ] Refactor (refactoring production code)
- [ ] Other
Checklist:
Codecov Report
Attention: Patch coverage is 19.04762% with 102 lines in your changes missing coverage. Please review.
Project coverage is 42.21%. Comparing base (
e85888f) to head (1ca80e1).
| Files with missing lines | Patch % | Lines |
|---|---|---|
| git-cliff/src/lib.rs | 0.00% | 62 Missing :warning: |
| git-cliff-core/src/repo.rs | 38.71% | 38 Missing :warning: |
| git-cliff-core/src/tag.rs | 0.00% | 2 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #711 +/- ##
==========================================
- Coverage 42.85% 42.21% -0.63%
==========================================
Files 21 22 +1
Lines 1734 1810 +76
==========================================
+ Hits 743 764 +21
- Misses 991 1046 +55
| Flag | Coverage Δ | |
|---|---|---|
| unit-tests | 42.21% <19.05%> (-0.63%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Keeping as draft as existing tests pass, but I still have to add new ones from the linked issue and some more edge cases I have in mind
Hey @DaniPopes are you still interested in working on this?
Hey, sorry I haven't been able to allocate more time on this, and I'll be off for a few weeks. Might come back to this in a month or so
Sounds good :)
ayo what's the progress on this 👀
closing due to inactivity