Skip to content

Commit e832cd0

Browse files
committed
feat(cli): commit hash validation
Fixes conventional-changelog#3376
1 parent d16dbe4 commit e832cd0

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

@commitlint/cli/src/cli.ts

+14
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,20 @@ async function main(args: MainArgs): Promise<void> {
200200

201201
const fromStdin = checkFromStdin(raw, flags);
202202

203+
if (
204+
typeof flags.from !== 'undefined' &&
205+
typeof flags.to !== 'undefined' &&
206+
flags.from === flags.to
207+
) {
208+
const err = new CliError(
209+
'Please use a different commit hash for --from and --to, not the same. (Or use the --last flag for analyzing just the last commit.)',
210+
pkg.name
211+
);
212+
yargs.showHelp('log');
213+
console.log(err.message);
214+
throw err;
215+
}
216+
203217
const input = await (fromStdin
204218
? stdin()
205219
: read({

0 commit comments

Comments
 (0)