Repository navigation
fix: disallow same commit hash for --from and --to - #4773
Merged
escapedcat merged 2 commits intoMay 24, 2026
Merged
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes commitlint CLI behavior when --from and --to are provided with the same value by failing early with a clearer error and a non-zero exit code, addressing issue #3376.
Changes:
- Added an early-guard in the CLI to detect
--from === --toand throw aCommitlintInvalidArgumenterror. - Added a regression test ensuring the CLI fails with the expected exit code and guidance when
--fromand--toare identical.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| @commitlint/cli/src/cli.ts | Adds early validation for --from/--to equality and emits a targeted invalid-argument error. |
| @commitlint/cli/src/cli.test.ts | Adds a regression test for the new invalid-argument behavior when --from and --to match. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
knocte
force-pushed
the
wip/rejectSameFromToParams
branch
from
May 24, 2026 15:04
0a00271 to
48964e5
Compare
escapedcat
merged commit May 24, 2026
121005e
into
conventional-changelog:master
12 of 22 checks passed
sys-support
pushed a commit
to 3caravelle/renovate
that referenced
this pull request
Jun 25, 2026
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [@commitlint/cli](https://commitlint.js.org/) ([source](https://github.com/conventional-changelog/commitlint/tree/HEAD/@commitlint/cli)) | [`21.0.1` → `21.1.0`](https://renovatebot.com/diffs/npm/@commitlint%2fcli/21.0.1/21.1.0) |  |  | | [@commitlint/config-conventional](https://commitlint.js.org/) ([source](https://github.com/conventional-changelog/commitlint/tree/HEAD/@commitlint/config-conventional)) | [`21.0.1` → `21.1.0`](https://renovatebot.com/diffs/npm/@commitlint%2fconfig-conventional/21.0.1/21.1.0) |  |  | --- ### Release Notes <details> <summary>conventional-changelog/commitlint (@​commitlint/cli)</summary> ### [`v21.1.0`](https://github.com/conventional-changelog/commitlint/blob/HEAD/@​commitlint/cli/CHANGELOG.md#2110-2026-06-23) [Compare Source](conventional-changelog/commitlint@v21.0.2...v21.1.0) ##### Features - **cli:** add --default-config flag to lint without a config file ([#​4805](conventional-changelog/commitlint#4805)) ([7af27ba](conventional-changelog/commitlint@7af27ba)), closes [#​3662](conventional-changelog/commitlint#3662) #### [21.0.2](conventional-changelog/commitlint@v21.0.1...v21.0.2) (2026-05-29) ##### Bug Fixes - disallow same commit hash for --from and --to ([#​4773](conventional-changelog/commitlint#4773)) ([121005e](conventional-changelog/commitlint@121005e)) #### [21.0.1](conventional-changelog/commitlint@v21.0.0...v21.0.1) (2026-05-12) **Note:** Version bump only for package [@​commitlint/cli](https://github.com/commitlint/cli) ### [`v21.0.2`](https://github.com/conventional-changelog/commitlint/blob/HEAD/@​commitlint/cli/CHANGELOG.md#2102-2026-05-29) [Compare Source](conventional-changelog/commitlint@v21.0.1...v21.0.2) ##### Bug Fixes - disallow same commit hash for --from and --to ([#​4773](conventional-changelog/commitlint#4773)) ([121005e](conventional-changelog/commitlint@121005e)) </details> <details> <summary>conventional-changelog/commitlint (@​commitlint/config-conventional)</summary> ### [`v21.1.0`](https://github.com/conventional-changelog/commitlint/blob/HEAD/@​commitlint/config-conventional/CHANGELOG.md#2110-2026-06-23) [Compare Source](conventional-changelog/commitlint@v21.0.2...v21.1.0) **Note:** Version bump only for package [@​commitlint/config-conventional](https://github.com/commitlint/config-conventional) #### [21.0.2](conventional-changelog/commitlint@v21.0.1...v21.0.2) (2026-05-29) **Note:** Version bump only for package [@​commitlint/config-conventional](https://github.com/commitlint/config-conventional) #### [21.0.1](conventional-changelog/commitlint@v21.0.0...v21.0.1) (2026-05-12) **Note:** Version bump only for package [@​commitlint/config-conventional](https://github.com/commitlint/config-conventional) ### [`v21.0.2`](https://github.com/conventional-changelog/commitlint/blob/HEAD/@​commitlint/config-conventional/CHANGELOG.md#2102-2026-05-29) [Compare Source](conventional-changelog/commitlint@v21.0.1...v21.0.2) **Note:** Version bump only for package [@​commitlint/config-conventional](https://github.com/commitlint/config-conventional) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi44MS4zIiwidXBkYXRlZEluVmVyIjoiNDIuODEuMyIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Reviewed-on: https://git.3caravelle.net/3Caravelle/renovate/pulls/37 Co-authored-by: Renovate Bot <renovate-bot@3caravelle.com> Co-committed-by: Renovate Bot <renovate-bot@3caravelle.com>
5 tasks done
pat-s
pushed a commit
to devxygmbh/ansible-data-science-core
that referenced
this pull request
Jul 20, 2026
…ocker tag to v21.2.1 (#95) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [cr.codefloe.com/docker.io/commitlint/commitlint](https://github.com/conventional-changelog/commitlint) | minor | `21.0.1` → `21.2.1` | --- ### Release Notes <details> <summary>conventional-changelog/commitlint (cr.codefloe.com/docker.io/commitlint/commitlint)</summary> ### [`v21.2.1`](https://github.com/conventional-changelog/commitlint/blob/HEAD/CHANGELOG.md#2121-2026-07-08) [Compare Source](conventional-changelog/commitlint@v21.2.0...v21.2.1) **Note:** Version bump only for package [@​commitlint/root](https://github.com/commitlint/root) ### [`v21.2.0`](https://github.com/conventional-changelog/commitlint/blob/HEAD/CHANGELOG.md#2120-2026-06-30) [Compare Source](conventional-changelog/commitlint@v21.1.0...v21.2.0) ##### Features - **resolve-extends:** resolve pure-ESM presets (conventional-changelog v7/v9/v10) ([#​4859](conventional-changelog/commitlint#4859)) ([fdb566f](conventional-changelog/commitlint@fdb566f)) ### [`v21.1.0`](https://github.com/conventional-changelog/commitlint/blob/HEAD/CHANGELOG.md#2110-2026-06-23) [Compare Source](conventional-changelog/commitlint@v21.0.2...v21.1.0) ##### Bug Fixes - remove duplicate es-toolkit\@​1.47.1 keys from lockfile ([#​4833](conventional-changelog/commitlint#4833)) ([b3323f5](conventional-changelog/commitlint@b3323f5)), closes [#​4831](conventional-changelog/commitlint#4831) ##### Features - **cli:** add --default-config flag to lint without a config file ([#​4805](conventional-changelog/commitlint#4805)) ([7af27ba](conventional-changelog/commitlint@7af27ba)), closes [#​3662](conventional-changelog/commitlint#3662) - **lint:** allow for custom commit parser function ([#​4829](conventional-changelog/commitlint#4829)) ([e820753](conventional-changelog/commitlint@e820753)), closes [#​4816](conventional-changelog/commitlint#4816) [#​4816](conventional-changelog/commitlint#4816) #### [21.0.2](conventional-changelog/commitlint@v21.0.1...v21.0.2) (2026-05-29) ##### Bug Fixes - apply oxfmt formatting to get-edit-commit.ts ([#​4768](conventional-changelog/commitlint#4768)) ([1af3138](conventional-changelog/commitlint@1af3138)), closes [#​4755](conventional-changelog/commitlint#4755) - **config-pnpm-scopes:** adapt to read-yaml-file v3 named export ([#​4701](conventional-changelog/commitlint#4701)) ([8b55772](conventional-changelog/commitlint@8b55772)) - disallow same commit hash for --from and --to ([#​4773](conventional-changelog/commitlint#4773)) ([121005e](conventional-changelog/commitlint@121005e)) - emit actionable error when --edit cannot find COMMIT\_EDITMSG ([#​589](conventional-changelog/commitlint#589)) ([#​4755](conventional-changelog/commitlint#4755)) ([bb10907](conventional-changelog/commitlint@bb10907)) - **read:** fail when --from and --to share no merge-base [#​4555](conventional-changelog/commitlint#4555) ([#​4754](conventional-changelog/commitlint#4754)) ([e4595eb](conventional-changelog/commitlint@e4595eb)) - update dependency [@​pnpm/read-project-manifest](https://github.com/pnpm/read-project-manifest) to v6 ([#​4617](conventional-changelog/commitlint#4617)) ([ca16ec1](conventional-changelog/commitlint@ca16ec1)) - update vitest monorepo to \~4.1.0 ([#​4654](conventional-changelog/commitlint#4654)) ([f1f25d5](conventional-changelog/commitlint@f1f25d5)) #### [21.0.1](conventional-changelog/commitlint@v21.0.0...v21.0.1) (2026-05-12) ##### Bug Fixes - **load:** only resolve relative formatter paths ([#​4761](conventional-changelog/commitlint#4761)) ([f8be069](conventional-changelog/commitlint@f8be069)) - **types:** add presetConfig to ParserPreset interface ([#​4749](conventional-changelog/commitlint#4749)) ([e402cd4](conventional-changelog/commitlint@e402cd4)), closes [#​4748](conventional-changelog/commitlint#4748) ### [`v21.0.2`](https://github.com/conventional-changelog/commitlint/blob/HEAD/CHANGELOG.md#2102-2026-05-29) [Compare Source](conventional-changelog/commitlint@v21.0.1...v21.0.2) ##### Bug Fixes - apply oxfmt formatting to get-edit-commit.ts ([#​4768](conventional-changelog/commitlint#4768)) ([1af3138](conventional-changelog/commitlint@1af3138)), closes [#​4755](conventional-changelog/commitlint#4755) - **config-pnpm-scopes:** adapt to read-yaml-file v3 named export ([#​4701](conventional-changelog/commitlint#4701)) ([8b55772](conventional-changelog/commitlint@8b55772)) - disallow same commit hash for --from and --to ([#​4773](conventional-changelog/commitlint#4773)) ([121005e](conventional-changelog/commitlint@121005e)) - emit actionable error when --edit cannot find COMMIT\_EDITMSG ([#​589](conventional-changelog/commitlint#589)) ([#​4755](conventional-changelog/commitlint#4755)) ([bb10907](conventional-changelog/commitlint@bb10907)) - **read:** fail when --from and --to share no merge-base [#​4555](conventional-changelog/commitlint#4555) ([#​4754](conventional-changelog/commitlint#4754)) ([e4595eb](conventional-changelog/commitlint@e4595eb)) - update dependency [@​pnpm/read-project-manifest](https://github.com/pnpm/read-project-manifest) to v6 ([#​4617](conventional-changelog/commitlint#4617)) ([ca16ec1](conventional-changelog/commitlint@ca16ec1)) - update vitest monorepo to \~4.1.0 ([#​4654](conventional-changelog/commitlint#4654)) ([f1f25d5](conventional-changelog/commitlint@f1f25d5)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4zMS4wIiwidXBkYXRlZEluVmVyIjoiNDMuMzEuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: devxy-bot <no-reply@devxy.io> Reviewed-on: https://codefloe.com/devxy/ansible-data-science-core/pulls/95
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.
Fixes #3376
Description
Before executing anything, make commitlint-cli check the --from and --to args, and if they are the same, throw an early error (before a more cryptic one throws under the hood, or before a misleading exitCode=0 happens).
Motivation and Context
#3376
Usage examples
See #3376
How Has This Been Tested?
TDD
Types of changes
Checklist: