Skip to content
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
18 changes: 9 additions & 9 deletions extensions/git/src/cloneManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,7 @@ export class CloneManager {
private readonly telemetryReporter: TelemetryReporter,
private readonly repositoryCache: RepositoryCache) { }

clone(url?: string, options: CloneOptions = {}) {
const cachedRepository = url ? this.repositoryCache.get(url) : undefined;
if (url && cachedRepository && (cachedRepository.length > 0)) {
return this.tryOpenExistingRepository(cachedRepository, url, options.postCloneAction, options.parentPath, options.ref);
}
return this.cloneRepository(url, options.parentPath, options);
}

private async cloneRepository(url?: string, parentPath?: string, options: { recursive?: boolean; ref?: string; postCloneAction?: ApiPostCloneAction } = {}): Promise<string | undefined> {
async clone(url?: string, options: CloneOptions = {}) {
if (!url || typeof url !== 'string') {
url = await pickRemoteSource({
providerLabel: provider => l10n.t('Clone from {0}', provider.name),
Expand All @@ -56,6 +48,14 @@ export class CloneManager {

url = url.trim().replace(/^git\s+clone\s+/, '');

const cachedRepository = this.repositoryCache.get(url);
if (cachedRepository && (cachedRepository.length > 0)) {
return this.tryOpenExistingRepository(cachedRepository, url, options.postCloneAction, options.parentPath, options.ref);
}
return this.cloneRepository(url, options.parentPath, options);
}

private async cloneRepository(url: string, parentPath?: string, options: { recursive?: boolean; ref?: string; postCloneAction?: ApiPostCloneAction } = {}): Promise<string | undefined> {
if (!parentPath) {
const config = workspace.getConfiguration('git');
let defaultCloneDirectory = config.get<string>('defaultCloneDirectory') || os.homedir();
Expand Down
1 change: 1 addition & 0 deletions extensions/git/src/protocolHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class GitProtocolHandler implements UriHandler {
this.disposables.push(window.registerUriHandler(this));
}

// example code-oss://vscode.git/clone?url=https://github.com/microsoft/vscode
handleUri(uri: Uri): void {
this.logger.info(`[GitProtocolHandler][handleUri] URI:(${uri.toString()})`);

Expand Down
Loading