File tree 1 file changed +16
-1
lines changed
1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -352,7 +352,9 @@ function checkFromStdin(input: (string | number)[], flags: CliFlags): boolean {
352
352
}
353
353
354
354
function checkFromRepository ( flags : CliFlags ) : boolean {
355
- return checkFromHistory ( flags ) || checkFromEdit ( flags ) ;
355
+ return (
356
+ ( checkFromHistory ( flags ) && checkFlagsValue ( flags ) ) || checkFromEdit ( flags )
357
+ ) ;
356
358
}
357
359
358
360
function checkFromEdit ( flags : CliFlags ) : boolean {
@@ -367,6 +369,19 @@ function checkFromHistory(flags: CliFlags): boolean {
367
369
) ;
368
370
}
369
371
372
+ function checkFlagsValue ( flags : CliFlags ) : boolean {
373
+ if ( flags . from === flags . to ) {
374
+ const err = new CliError (
375
+ 'Please use a different commit hash for --from and --to, not the same. (Or use the --last flag for analyzing just the last commit.)' ,
376
+ pkg . name
377
+ ) ;
378
+ yargs . showHelp ( 'log' ) ;
379
+ console . log ( err . message ) ;
380
+ throw err ;
381
+ }
382
+ return true ;
383
+ }
384
+
370
385
function normalizeFlags ( flags : CliFlags ) : CliFlags {
371
386
const edit = getEditValue ( flags ) ;
372
387
return {
You can’t perform that action at this time.
0 commit comments