@@ -9,15 +9,21 @@ import { readJson } from '../object/readJson';
99import { bulletedList } from '../logging/bulletedList' ;
1010import { getAllChangedPackages } from './getAllChangedPackages' ;
1111import { getIncludedLoggers , isPackageIncluded } from './isPackageIncluded' ;
12- import { ensureSharedHistory , hasCommonCommit } from '../git/ensureSharedHistory' ;
12+ import { ensureSharedHistory } from '../git/ensureSharedHistory' ;
1313
1414/**
1515 * Gets all the changed packages which **do not already have a change file** and are in scope.
16+ * This is only used by the `change` and `check` commands, not the bump/publish process.
1617 *
17- * Exceptions :
18+ * Special cases :
1819 * - If `options.package` is provided, use that as-is (skipping all git operations).
1920 * - If `options.all` is true, gets all the packages in scope regardless of whether they've changed
20- * (skipping git diff of files), filtered by packages that already have change files.
21+ * (skipping git diff of files), omitting packages that already have change files.
22+ *
23+ * Usually (without `options.package`) this has the side effect of calling `ensureSharedHistory` to
24+ * verify that enough git history is available to check for changes between `HEAD` and
25+ * `options.branch` (only an issue for shallow clones), and deepens the history if needed.
26+ * Unless `options.fetch` is `false`, it will also fetch from the remote.
2127 */
2228export function getChangedPackages (
2329 options : BeachballOptions ,
@@ -33,10 +39,10 @@ export function getChangedPackages(
3339
3440 console . log ( `Checking for changes against "${ options . branch } "` ) ;
3541
36- // We should fetch shared history even with --all for accurate change file checks later
37- if ( ! hasCommonCommit ( branch , options . path ) ) {
38- ensureSharedHistory ( options ) ;
39- }
42+ // Ensure the current branch and target branch have a common shared commit. This has the side
43+ // effect of fetching from the remote (unless disabled), which should be done even if there's
44+ // already shared history (and even with --all) for accurate added change file checks later.
45+ ensureSharedHistory ( options ) ;
4046
4147 let changedPackages : string [ ] ;
4248
0 commit comments