fix: assign commits to closest tag for include-path filtering#1
Open
fix: assign commits to closest tag for include-path filtering#1
Conversation
Rebases DaniPopes/git-cliff@fix-include-paths on top of current main. Introduces TaggedCommits struct in its own module (tagged.rs) for better commit-to-tag mapping with get_closest() support. Updates all callers in lib.rs to use the new API. Adds unit tests for all TaggedCommits methods. Fixes orhun#208. Co-Authored-By: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Co-Authored-By: zerosnacks <95942363+zerosnacks@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d8b4f-670b-76db-9c93-d14f69ef4c55
8253160 to
d0d0e8f
Compare
zerosnacks
reviewed
Apr 14, 2026
danipopes/git-cliff fork
danipopes/git-cliff fork- Fix tag_indexes doc comment (was backwards about ordering) - Make insert() return bool and no-op on unknown commits - Fix repository.path() -> root_path() regression in fill_release - Fix append_release to not create fake empty previous for first release - Replace unwrap() with expect() for better panic messages - Fix retain() to filter tags map directly (was only filtering tag_indexes) - Add doc comment explaining Tag PartialEq by-name semantics - Add insert_unknown_commit_is_noop test Co-Authored-By: zerosnacks <95942363+zerosnacks@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019dab72-9199-7439-aefa-ef1efc746210
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.
Description
Rebases DaniPopes/git-cliff@fix-include-paths on top of current
main, incorporating maintainer feedback from orhun/git-cliff#711.Introduces a
TaggedCommitsstruct in its own module (tagged.rs) for better commit-to-tag mapping. When using--include-path/--exclude-path, tagged commits could be filtered out, causing entire tags to be skipped. This PR assigns commits to the closest tag viaget_closest()instead of requiring exact matches.Changes
TaggedCommitsstruct (tagged.rs) withget_closest()for nearest-tag lookupPartialEq/EqforTag(compares by name, documented rationale)lib.rsto useTaggedCommitsAPI instead of rawIndexMap<String, Tag>get_closest()for correct include-path behaviorTaggedCommitsmethods (addressing maintainer feedback)insert()returnsbooland no-ops on unknown commits to preserve invariantsretain()filterstagsmap directly (not justtag_indexes) fixing correctness bugappend_release()avoids creating a fake emptypreviousfor the first releaseroot_path()forrelease.repository(was changed topath()by mistake)Motivation and Context
Fixes orhun#208 — when using
--include-path/--exclude-path, tagged commits could be filtered out, causing entire tags to be skipped.How Has This Been Tested?
TaggedCommitsmethods (len,is_empty,last,get,get_index,get_closest,contains_commit,get_commit,insert,insert_unknown_commit_is_noop,retain,tagsiterator)Types of Changes
Checklist:
cargo +nightly fmt --allcargo clippy --tests --verbose -- -D warningscargo testCo-Authored-By: DaniPopes 57450786+DaniPopes@users.noreply.github.com
Co-Authored-By: zerosnacks 95942363+zerosnacks@users.noreply.github.com