File tree Expand file tree Collapse file tree 3 files changed +11
-13
lines changed Expand file tree Collapse file tree 3 files changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -22,9 +22,7 @@ exports.builder = (yargs) =>
22
22
exports . options = kebabcaseKeys ( {
23
23
fetchDepth : {
24
24
type : 'number' ,
25
- default : 1 ,
26
- description :
27
- 'Number of commits to fetch. 0 indicates all history for all branches and tags'
25
+ description : 'Number of commits to fetch (use `0` for all branches & tags)'
28
26
} ,
29
27
unshallow : {
30
28
type : 'boolean' ,
Original file line number Diff line number Diff line change @@ -20,8 +20,8 @@ describe('CML e2e', () => {
20
20
--help Show help [boolean]
21
21
22
22
Options:
23
- --fetch-depth Number of commits to fetch. 0 indicates all history for all
24
- branches and tags [number] [default: 1 ]
23
+ --fetch-depth Number of commits to fetch (use \`0\` for all branches & tags)
24
+ [number ]
25
25
--user-email Git user email [string] [default: \\"olivaw@iterative.ai\\"]
26
26
--user-name Git user name [string] [default: \\"Olivaw[bot]\\"]"
27
27
` ) ;
Original file line number Diff line number Diff line change @@ -501,19 +501,19 @@ class CML {
501
501
userName = GIT_USER_NAME ,
502
502
remote = GIT_REMOTE
503
503
} = opts ;
504
- let { fetchDepth = 1 } = opts ;
504
+ const { fetchDepth = unshallow ? 0 : undefined } = opts ;
505
505
506
506
const driver = this . getDriver ( ) ;
507
507
await exec ( await driver . updateGitConfig ( { userName, userEmail, remote } ) ) ;
508
- if ( unshallow ) {
509
- if ( ( await exec ( 'git rev-parse --is-shallow-repository' ) ) === 'true' ) {
510
- fetchDepth = 0 ;
508
+ if ( fetchDepth !== undefined ) {
509
+ if ( fetchDepth <= 0 ) {
510
+ if ( ( await exec ( 'git rev-parse --is-shallow-repository' ) ) === 'true' ) {
511
+ return await exec ( 'git fetch --all --unshallow' ) ;
512
+ }
513
+ } else {
514
+ return await exec ( `git fetch --all --depth=${ fetchDepth } ` ) ;
511
515
}
512
516
}
513
- if ( fetchDepth <= 0 ) {
514
- return await exec ( 'git fetch --all --unshallow' ) ;
515
- }
516
- return await exec ( `git fetch --all --depth=${ fetchDepth } ` ) ;
517
517
}
518
518
519
519
async prCreate ( opts = { } ) {
You can’t perform that action at this time.
0 commit comments