Repository navigation
feat(parser): support abbreviated SHAs in commit parsers - #1642
Merged
Merged
Conversation
The `sha` of a commit parser can now be an abbreviated SHA (at least 4 characters), e.g. the short SHA printed by `git cliff -vv`. It is expanded to the full SHA of the matching commit before the commits are processed. Like git, an abbreviated SHA that matches more than one commit is an error. Closes orhun#1638
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1642 +/- ##
==========================================
+ Coverage 53.22% 53.37% +0.16%
==========================================
Files 28 28
Lines 2631 2657 +26
==========================================
+ Hits 1400 1418 +18
- Misses 1231 1239 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
1 task done
7 tasks done
|
Congrats on merging your first pull request! ⛰️ |
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
The
shaof a commit parser can now be an abbreviated SHA (at least 4 characters). Before the commits are processed, each parser SHA is expanded to the full SHA of the commit it matches:commit parser SHA `076f` is ambiguous, it matches 3 commitsThe resolution happens once in
Changelog::process_commits, soCommit::parsestill does an exact comparison.Motivation and Context
Closes #1638.
git cliff -vvprints short SHAs, so it's handy to be able to paste them intocommit_parsersdirectly.How Has This Been Tested?
changelog_resolves_abbreviated_commit_parser_shasandchangelog_rejects_ambiguous_commit_parser_sha.cargo test --workspace(full clone): everything passes exceptopen_jujutsu_repoanddiscover_jujutsu_repo, which fail the same way onmainon Windows (path canonicalization).{ sha = "<short>", group = "Picked" }:f07a7c8picks that commit.076ffails with the ambiguity error (3 commits share that prefix).076fc85picks the intended commit.Types of Changes
Checklist:
cargo +nightly fmt --allcargo clippy --tests --verbose -- -D warnings(no warnings from this change; on Windows the only error is the unusedsuper::*incommand.rs, whose test is Unix-only)cargo test