File tree Expand file tree Collapse file tree 3 files changed +18
-7
lines changed Expand file tree Collapse file tree 3 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -20,10 +20,17 @@ exports.builder = (yargs) =>
20
20
. options ( exports . options ) ;
21
21
22
22
exports . options = kebabcaseKeys ( {
23
+ fetchDepth : {
24
+ type : 'number' ,
25
+ default : 1 ,
26
+ description :
27
+ 'Number of commits to fetch. 0 indicates all history for all branches and tags'
28
+ } ,
23
29
unshallow : {
24
30
type : 'boolean' ,
25
31
description :
26
- 'Fetch as much as possible, converting a shallow repository to a complete one'
32
+ 'Fetch as much as possible, converting a shallow repository to a complete one' ,
33
+ hidden : true
27
34
} ,
28
35
userEmail : {
29
36
type : 'string' ,
Original file line number Diff line number Diff line change @@ -20,10 +20,10 @@ describe('CML e2e', () => {
20
20
--help Show help [boolean]
21
21
22
22
Options:
23
- --unshallow Fetch as much as possible, converting a shallow repository to a
24
- complete one [boolean ]
25
- --user-email Git user email [string] [default: \\"olivaw@iterative.ai\\"]
26
- --user-name Git user name [string] [default: \\"Olivaw[bot]\\"]"
23
+ --fetch-depth Number of commits to fetch. 0 indicates all history for all
24
+ branches and tags [number] [default: 1 ]
25
+ --user-email Git user email [string] [default: \\"olivaw@iterative.ai\\"]
26
+ --user-name Git user name [string] [default: \\"Olivaw[bot]\\"]"
27
27
` ) ;
28
28
} ) ;
29
29
} ) ;
Original file line number Diff line number Diff line change @@ -469,15 +469,19 @@ class CML {
469
469
userName = GIT_USER_NAME ,
470
470
remote = GIT_REMOTE
471
471
} = opts ;
472
+ let { fetchDepth = 1 } = opts ;
472
473
473
474
const driver = this . getDriver ( ) ;
474
475
await exec ( await driver . updateGitConfig ( { userName, userEmail, remote } ) ) ;
475
476
if ( unshallow ) {
476
477
if ( ( await exec ( 'git rev-parse --is-shallow-repository' ) ) === 'true' ) {
477
- await exec ( 'git fetch --unshallow' ) ;
478
+ fetchDepth = 0 ;
478
479
}
479
480
}
480
- await exec ( 'git fetch --all' ) ;
481
+ if ( fetchDepth <= 0 ) {
482
+ return await exec ( 'git fetch --all --unshallow' ) ;
483
+ }
484
+ return await exec ( `git fetch --all --depth=${ fetchDepth } ` ) ;
481
485
}
482
486
483
487
async prCreate ( opts = { } ) {
You can’t perform that action at this time.
0 commit comments