Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix submodules unhandler error #1191

Merged
merged 3 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions jupyterlab_git/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,24 @@ async def post(self, path: str = ""):
Input format:
{
'repo_url': 'https://github.com/path/to/myrepo',
OPTIONAL 'auth': '{ 'username': '<username>',
'password': '<password>',
'cache_credentials': true/false
}'
OPTIONAL 'auth': {
'username': '<username>',
'password': '<password>',
'cache_credentials': true/false
},
# Whether to version the clone (True) or copy (False) it.
OPTIONAL 'versioning': True,
# Whether to clone the submodules or not.
OPTIONAL 'submodules': False
}
"""
data = self.get_json_body()
response = await self.git.clone(
self.url2localpath(path),
data["clone_url"],
data.get("auth", None),
data["versioning"],
data["submodules"],
data.get("versioning", True),
data.get("submodules", False),
)

if response["code"] != 0:
Expand Down
3 changes: 2 additions & 1 deletion src/cloneCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ export const gitCloneCommandPlugin: JupyterFrontEndPlugin<void> = {
{
path: fileBrowserModel.path,
url: result.value.url,
versioning: result.value.versioning
versioning: result.value.versioning,
submodules: result.value.submodules
}
);
logger.log({
Expand Down
10 changes: 8 additions & 2 deletions src/commandsAndMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ export interface IGitCloneArgs {
* If false, this will remove the .git folder after cloning.
*/
versioning?: boolean;
/**
* Whether to activate git recurse submodules clone or not.
*/
submodules?: boolean;
}

/**
Expand Down Expand Up @@ -1544,12 +1548,14 @@ export async function showGitOperationDialog<T>(
switch (operation) {
case Operation.Clone:
// eslint-disable-next-line no-case-declarations
const { path, url, versioning } = args as any as IGitCloneArgs;
const { path, url, versioning, submodules } =
args as any as IGitCloneArgs;
result = await model.clone(
path,
url,
authentication,
versioning ?? true
versioning ?? true,
submodules ?? false
);
break;
case Operation.Pull:
Expand Down
5 changes: 4 additions & 1 deletion src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ export class GitExtension implements IGitExtension {
* @param url - Git repository URL
* @param auth - remote repository authentication information
* @param versioning - boolean flag of Git metadata (default true)
* @param submodules - boolean flag of Git submodules (default false)
* @returns promise which resolves upon cloning a repository
*
* @throws {Git.GitResponseError} If the server response is not ok
Expand All @@ -629,7 +630,8 @@ export class GitExtension implements IGitExtension {
path: string,
url: string,
auth?: Git.IAuth,
versioning = true
versioning = true,
submodules = false
): Promise<Git.IResultWithMessage> {
return await this._taskHandler.execute<Git.IResultWithMessage>(
'git:clone',
Expand All @@ -640,6 +642,7 @@ export class GitExtension implements IGitExtension {
{
clone_url: url,
versioning: versioning,
submodules: submodules,
auth: auth as any
}
);
Expand Down
4 changes: 3 additions & 1 deletion src/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ export interface IGitExtension extends IDisposable {
* @param url - Git repository URL
* @param auth - remote repository authentication information
* @param versioning - Whether to clone or download the Git repository
* @param submodules - Whether to clone recursively the Git submodules
* @returns promise which resolves upon cloning a repository
*
* @throws {Git.GitResponseError} If the server response is not ok
Expand All @@ -242,7 +243,8 @@ export interface IGitExtension extends IDisposable {
path: string,
url: string,
auth?: Git.IAuth,
versioning?: boolean
versioning?: boolean,
submodules?: boolean
): Promise<Git.IResultWithMessage>;

/**
Expand Down