File tree Expand file tree Collapse file tree 5 files changed +28
-11
lines changed Expand file tree Collapse file tree 5 files changed +28
-11
lines changed Original file line number Diff line number Diff line change @@ -77,19 +77,24 @@ async def post(self, path: str = ""):
77
77
Input format:
78
78
{
79
79
'repo_url': 'https://github.com/path/to/myrepo',
80
- OPTIONAL 'auth': '{ 'username': '<username>',
81
- 'password': '<password>',
82
- 'cache_credentials': true/false
83
- }'
80
+ OPTIONAL 'auth': {
81
+ 'username': '<username>',
82
+ 'password': '<password>',
83
+ 'cache_credentials': true/false
84
+ },
85
+ # Whether to version the clone (True) or copy (False) it.
86
+ OPTIONAL 'versioning': True,
87
+ # Whether to clone the submodules or not.
88
+ OPTIONAL 'submodules': False
84
89
}
85
90
"""
86
91
data = self .get_json_body ()
87
92
response = await self .git .clone (
88
93
self .url2localpath (path ),
89
94
data ["clone_url" ],
90
95
data .get ("auth" , None ),
91
- data [ "versioning" ] ,
92
- data [ "submodules" ] ,
96
+ data . get ( "versioning" , True ) ,
97
+ data . get ( "submodules" , False ) ,
93
98
)
94
99
95
100
if response ["code" ] != 0 :
Original file line number Diff line number Diff line change @@ -59,7 +59,8 @@ export const gitCloneCommandPlugin: JupyterFrontEndPlugin<void> = {
59
59
{
60
60
path : fileBrowserModel . path ,
61
61
url : result . value . url ,
62
- versioning : result . value . versioning
62
+ versioning : result . value . versioning ,
63
+ submodules : result . value . submodules
63
64
}
64
65
) ;
65
66
logger . log ( {
Original file line number Diff line number Diff line change @@ -65,6 +65,10 @@ export interface IGitCloneArgs {
65
65
* If false, this will remove the .git folder after cloning.
66
66
*/
67
67
versioning ?: boolean ;
68
+ /**
69
+ * Whether to activate git recurse submodules clone or not.
70
+ */
71
+ submodules ?: boolean ;
68
72
}
69
73
70
74
/**
@@ -1544,12 +1548,14 @@ export async function showGitOperationDialog<T>(
1544
1548
switch ( operation ) {
1545
1549
case Operation . Clone :
1546
1550
// eslint-disable-next-line no-case-declarations
1547
- const { path, url, versioning } = args as any as IGitCloneArgs ;
1551
+ const { path, url, versioning, submodules } =
1552
+ args as any as IGitCloneArgs ;
1548
1553
result = await model . clone (
1549
1554
path ,
1550
1555
url ,
1551
1556
authentication ,
1552
- versioning ?? true
1557
+ versioning ?? true ,
1558
+ submodules ?? false
1553
1559
) ;
1554
1560
break ;
1555
1561
case Operation . Pull :
Original file line number Diff line number Diff line change @@ -620,6 +620,7 @@ export class GitExtension implements IGitExtension {
620
620
* @param url - Git repository URL
621
621
* @param auth - remote repository authentication information
622
622
* @param versioning - boolean flag of Git metadata (default true)
623
+ * @param submodules - boolean flag of Git submodules (default false)
623
624
* @returns promise which resolves upon cloning a repository
624
625
*
625
626
* @throws {Git.GitResponseError } If the server response is not ok
@@ -629,7 +630,8 @@ export class GitExtension implements IGitExtension {
629
630
path : string ,
630
631
url : string ,
631
632
auth ?: Git . IAuth ,
632
- versioning = true
633
+ versioning = true ,
634
+ submodules = false
633
635
) : Promise < Git . IResultWithMessage > {
634
636
return await this . _taskHandler . execute < Git . IResultWithMessage > (
635
637
'git:clone' ,
@@ -640,6 +642,7 @@ export class GitExtension implements IGitExtension {
640
642
{
641
643
clone_url : url ,
642
644
versioning : versioning ,
645
+ submodules : submodules ,
643
646
auth : auth as any
644
647
}
645
648
) ;
Original file line number Diff line number Diff line change @@ -233,6 +233,7 @@ export interface IGitExtension extends IDisposable {
233
233
* @param url - Git repository URL
234
234
* @param auth - remote repository authentication information
235
235
* @param versioning - Whether to clone or download the Git repository
236
+ * @param submodules - Whether to clone recursively the Git submodules
236
237
* @returns promise which resolves upon cloning a repository
237
238
*
238
239
* @throws {Git.GitResponseError } If the server response is not ok
@@ -242,7 +243,8 @@ export interface IGitExtension extends IDisposable {
242
243
path : string ,
243
244
url : string ,
244
245
auth ?: Git . IAuth ,
245
- versioning ?: boolean
246
+ versioning ?: boolean ,
247
+ submodules ?: boolean
246
248
) : Promise < Git . IResultWithMessage > ;
247
249
248
250
/**
You can’t perform that action at this time.
0 commit comments