Repository navigation
fix: let git's revert subjects through and accept the revert type - #724
Conversation
git revert writes 'Reapply "..."' when the commit it reverts is itself a revert (git 2.43+); CC001 now exempts it as it already did 'Revert "...". CC007 counts it as a revert, so allow_revert_commits = false still rejects it. The subject length rules no longer measure 'Revert "..."' or 'Reapply "..."': the nine extra characters are git's, and a subject that fit the limit was rejected once reverted. revert joins the default commit types. v1 accepted "revert: ...", the Conventional Commits FAQ recommends it for a hand-written revert, and 16 owners in public configs add it back by hand.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #724 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 16 16
Lines 3074 3078 +4
Branches 608 608
=========================================
+ Hits 3074 3078 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
Docs for CLI v2.23.1, which ships commit-check/commit-check#724. - **Pins:** every pre-commit `rev:` moves from `v2.23.0` to `v2.23.1` (Configuration, Example, Compare, pre-commit guide). docs-sync checks these against PyPI. - **Changelog:** a v2.23.1 entry and a Highlights row: the message quoted once over several failures (commit-check/commit-check#719), the intro on a bare `commit-check` (commit-check/commit-check#718), and git's revert subjects plus the `revert` type (commit-check/commit-check#724). - **Configuration:** `revert` is added to the `allow_commit_types` default. The length rows say `Revert "..."` and `Reapply "..."` subjects are not measured, and `allow_revert_commits` now names both subjects. - **Rules:** CC001 accepts git's revert subjects and points hand-written reverts to the `revert` type. CC004 lists them under "Not counted". CC007 covers `Reapply "..."` too. - **Migration:** the warning no longer tells v1 users to add `revert` back. It keeps the `task` branch type. - **Examples:** the sample CC001 output in Getting started, Example and Other CI lists `revert`. The two-failure sample in the policy guide was rerun on 2.23.1 and is unchanged. `pytest tests/` (docs-sync, against commit-check 2.23.1 from PyPI) and `nox -s docs` (`mkdocs build --strict`) pass locally. --------- Co-authored-by: Xianpeng Shen <3353385+shenxianpeng@users.noreply.github.com>



This fixes three ways a revert is rejected today.
Reapply "..."fails CC001. Since git 2.43,git revertwritesReapply "<subject>"when the commit it reverts is itself a revert. CC001 exempted onlyRevert ", so it now exemptsReapply "the same way. CC007 also counts it as a revert, soallow_revert_commits = falsestill rejects it.Revert "..."adds 9 characters, so a subject that fit the limit was rejected once reverted. The length rules now skipRevert "andReapply "subjects, as they already skip merge subjects. A subject that only starts with the word ("Revert the parser change ...") is still measured.revert:is not a default type. v1 acceptedrevert: ..., the Conventional Commits FAQ recommends it for a revert written by hand, and 16 owners in public configs add it back toallow_commit_typesby hand. It is now in the default list.GitHub's and GitLab's revert buttons write the same
Revert "<subject>"subject as git.Before / after
Tests
New tests cover
Reapplyunder CC001 and CC007, the length rules skipping both git subjects but not prose, andrevert:/revert(scope):passing the default config. Engine and rule builder tests: 700 passed.The site docs (default type list, CC004 and CC007 rows, and the migration note telling v1 users to add
revertback) go in a separate commit-check.com PR to merge with the release.Summary by CodeRabbit
Bug Fixes
RevertandReapplycommits are now handled consistently in commit validation. They’re accepted by default, and the setting to disallow revert commits also disallows reapply commits.Documentation
revertto the default allowed commit types.