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 = ""):
7777 Input format:
7878 {
7979 '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
8489 }
8590 """
8691 data = self .get_json_body ()
8792 response = await self .git .clone (
8893 self .url2localpath (path ),
8994 data ["clone_url" ],
9095 data .get ("auth" , None ),
91- data [ "versioning" ] ,
92- data [ "submodules" ] ,
96+ data . get ( "versioning" , True ) ,
97+ data . get ( "submodules" , False ) ,
9398 )
9499
95100 if response ["code" ] != 0 :
Original file line number Diff line number Diff line change @@ -59,7 +59,8 @@ export const gitCloneCommandPlugin: JupyterFrontEndPlugin<void> = {
5959 {
6060 path : fileBrowserModel . path ,
6161 url : result . value . url ,
62- versioning : result . value . versioning
62+ versioning : result . value . versioning ,
63+ submodules : result . value . submodules
6364 }
6465 ) ;
6566 logger . log ( {
Original file line number Diff line number Diff line change @@ -65,6 +65,10 @@ export interface IGitCloneArgs {
6565 * If false, this will remove the .git folder after cloning.
6666 */
6767 versioning ?: boolean ;
68+ /**
69+ * Whether to activate git recurse submodules clone or not.
70+ */
71+ submodules ?: boolean ;
6872}
6973
7074/**
@@ -1544,12 +1548,14 @@ export async function showGitOperationDialog<T>(
15441548 switch ( operation ) {
15451549 case Operation . Clone :
15461550 // 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 ;
15481553 result = await model . clone (
15491554 path ,
15501555 url ,
15511556 authentication ,
1552- versioning ?? true
1557+ versioning ?? true ,
1558+ submodules ?? false
15531559 ) ;
15541560 break ;
15551561 case Operation . Pull :
Original file line number Diff line number Diff line change @@ -620,6 +620,7 @@ export class GitExtension implements IGitExtension {
620620 * @param url - Git repository URL
621621 * @param auth - remote repository authentication information
622622 * @param versioning - boolean flag of Git metadata (default true)
623+ * @param submodules - boolean flag of Git submodules (default false)
623624 * @returns promise which resolves upon cloning a repository
624625 *
625626 * @throws {Git.GitResponseError } If the server response is not ok
@@ -629,7 +630,8 @@ export class GitExtension implements IGitExtension {
629630 path : string ,
630631 url : string ,
631632 auth ?: Git . IAuth ,
632- versioning = true
633+ versioning = true ,
634+ submodules = false
633635 ) : Promise < Git . IResultWithMessage > {
634636 return await this . _taskHandler . execute < Git . IResultWithMessage > (
635637 'git:clone' ,
@@ -640,6 +642,7 @@ export class GitExtension implements IGitExtension {
640642 {
641643 clone_url : url ,
642644 versioning : versioning ,
645+ submodules : submodules ,
643646 auth : auth as any
644647 }
645648 ) ;
Original file line number Diff line number Diff line change @@ -233,6 +233,7 @@ export interface IGitExtension extends IDisposable {
233233 * @param url - Git repository URL
234234 * @param auth - remote repository authentication information
235235 * @param versioning - Whether to clone or download the Git repository
236+ * @param submodules - Whether to clone recursively the Git submodules
236237 * @returns promise which resolves upon cloning a repository
237238 *
238239 * @throws {Git.GitResponseError } If the server response is not ok
@@ -242,7 +243,8 @@ export interface IGitExtension extends IDisposable {
242243 path : string ,
243244 url : string ,
244245 auth ?: Git . IAuth ,
245- versioning ?: boolean
246+ versioning ?: boolean ,
247+ submodules ?: boolean
246248 ) : Promise < Git . IResultWithMessage > ;
247249
248250 /**
You can’t perform that action at this time.
0 commit comments