-
Notifications
You must be signed in to change notification settings - Fork 963
fix: map kebab-case first-parent arg to camelCase for git-client v5 (#4704) #4706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -71,8 +71,10 @@ export default async function getCommitMessages( | |||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| let gitOptions: GitOptions = { from, to }; | ||||||||||||||||||||||||
| if (gitLogArgs) { | ||||||||||||||||||||||||
| const { _, ...parsedArgs } = minimist(gitLogArgs.split(" ")); | ||||||||||||||||||||||||
| gitOptions = { | ||||||||||||||||||||||||
| ...minimist(gitLogArgs.split(" ")), | ||||||||||||||||||||||||
| ...parsedArgs, | ||||||||||||||||||||||||
| firstParent: parsedArgs["first-parent"], | ||||||||||||||||||||||||
|
Comment on lines
75
to
+77
|
||||||||||||||||||||||||
| from, | ||||||||||||||||||||||||
|
Comment on lines
+74
to
78
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1. Firstparent overwritten to undefined In getCommitMessages(), firstParent is always assigned from parsedArgs["first-parent"] after spreading parsedArgs, which overwrites any parsedArgs.firstParent value (e.g., from --firstParent) with undefined. This makes --git-log-args parsing silently drop a valid firstParent setting and always injects a firstParent property when gitLogArgs is set. Agent Prompt
|
||||||||||||||||||||||||
| to, | ||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||
|
Comment on lines
+77
to
80
|
||||||||||||||||||||||||
| firstParent: parsedArgs["first-parent"], | |
| from, | |
| to, | |
| }; | |
| from, | |
| to, | |
| }; | |
| if (Object.prototype.hasOwnProperty.call(parsedArgs, "first-parent")) { | |
| gitOptions.firstParent = parsedArgs["first-parent"]; | |
| } |
Copilot
AI
Apr 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change adds new behavior for gitLogArgs parsing (dropping minimist’s _ and mapping --first-parent to firstParent), but @commitlint/read/src/read.test.ts currently only covers --skip. Add a test case that verifies --git-log-args='--first-parent' results in first-parent history only (or at least that the correct option is passed through), to prevent regressions like #4704.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const { _, ...parsedArgs } = …introduces an unused local (_). WithnoUnusedLocals: truein the repo TS config, this will fail type-check/build unless_is used or removed. Consider deleting._from the minimist result instead of destructuring it, or explicitly marking the binding as used (e.g.void _) so the compiler doesn’t flag it.