Improve layering for git model (#272857)

* Improve layering for git model
- Git clone doesn't belong in the model, removed it
- All the extra repo picking didn't seem to fit into `Git` though, as that is really about git operations
- Added a `CloneUtils` namespace for all the clone stuff to live.

* Update extensions/git/src/clone.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* CloneManager class

* public/private
This commit is contained in:
Alex Ross
2025-10-23 16:04:35 +02:00
committed by GitHub
parent 43ce6485c5
commit 3cc447e709
6 changed files with 296 additions and 257 deletions

View File

@@ -19,6 +19,7 @@ import { GitTimelineItem } from './timelineProvider';
import { ApiRepository } from './api/api1';
import { getRemoteSourceActions, pickRemoteSource } from './remoteSource';
import { RemoteSourceAction } from './typings/git-base';
import { CloneManager } from './cloneManager';
abstract class CheckoutCommandItem implements QuickPickItem {
abstract get label(): string;
@@ -774,7 +775,8 @@ export class CommandCenter {
private model: Model,
private globalState: Memento,
private logger: LogOutputChannel,
private telemetryReporter: TelemetryReporter
private telemetryReporter: TelemetryReporter,
private cloneManager: CloneManager
) {
this.disposables = Commands.map(({ commandId, key, method, options }) => {
const command = this.createCommand(commandId, key, method, options);
@@ -1016,12 +1018,12 @@ export class CommandCenter {
@command('git.clone')
async clone(url?: string, parentPath?: string, options?: { ref?: string }): Promise<void> {
await this.model.clone(url, { parentPath, ...options });
await this.cloneManager.clone(url, { parentPath, ...options });
}
@command('git.cloneRecursive')
async cloneRecursive(url?: string, parentPath?: string): Promise<void> {
await this.model.clone(url, { parentPath, recursive: true });
await this.cloneManager.clone(url, { parentPath, recursive: true });
}
@command('git.init')