From e6864cf8f39d00a87d0b11965ca4848175b1a1ec Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 13 Sep 2025 14:13:57 -0500 Subject: [PATCH] Clone full repo history, except when cloning a stack (for a new project) --- src/lib/ProjectsManager.ts | 6 +++--- src/lib/commands/git/log.ts | 6 +----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/lib/ProjectsManager.ts b/src/lib/ProjectsManager.ts index e0b21d2c..293c634a 100644 --- a/src/lib/ProjectsManager.ts +++ b/src/lib/ProjectsManager.ts @@ -37,7 +37,7 @@ export class ProjectsManager { } async createProject(name: string, customId?: string): Promise { - const project = await this.cloneProject(name, GIT_TEMPLATE_URL, customId); + const project = await this.cloneProject(name, GIT_TEMPLATE_URL, customId, { depth: 1 }); try { await this.fs.mkdir(this.dir + `/${project.id}/.ai/history`, { recursive: true }); @@ -93,7 +93,7 @@ export class ProjectsManager { return project; } - async cloneProject(name: string, repoUrl: string, customId?: string): Promise { + async cloneProject(name: string, repoUrl: string, customId?: string, options?: { depth?: number }): Promise { const url = new URL(repoUrl); const id = customId || await this.generateUniqueProjectId(name); @@ -113,7 +113,7 @@ export class ProjectsManager { dir: projectPath, url: repoUrl, singleBranch: true, - depth: 1, + depth: options?.depth, // Use depth if provided, otherwise clone full history // Use the CORS proxy only for GitHub and GitLab URLs // More info: https://github.com/isomorphic-git/isomorphic-git#cors-support corsProxy: url.hostname === 'github.com' || url.hostname === 'gitlab.com' diff --git a/src/lib/commands/git/log.ts b/src/lib/commands/git/log.ts index acfcd501..f03c09ac 100644 --- a/src/lib/commands/git/log.ts +++ b/src/lib/commands/git/log.ts @@ -15,7 +15,7 @@ export class GitLogCommand implements GitSubcommand { try { await fs.stat(`${cwd}/.git`); } catch { - return createErrorError('fatal: not a git repository (or any of the parent directories): .git'); + return createErrorResult('fatal: not a git repository (or any of the parent directories): .git'); } const { options, limit } = this.parseArgs(args); @@ -142,7 +142,3 @@ export class GitLogCommand implements GitSubcommand { } } -// Fix the typo in the error function -function createErrorError(message: string): ShellCommandResult { - return createErrorResult(message); -} \ No newline at end of file