From 7de31e10b0818bdb1d8e05fac604255d7f1086f1 Mon Sep 17 00:00:00 2001 From: cte Date: Wed, 12 Feb 2025 13:27:19 -0800 Subject: [PATCH] Checkpoints logging tweaks --- src/services/checkpoints/ShadowCheckpointService.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/services/checkpoints/ShadowCheckpointService.ts b/src/services/checkpoints/ShadowCheckpointService.ts index 18e7e69a53a..301602312ec 100644 --- a/src/services/checkpoints/ShadowCheckpointService.ts +++ b/src/services/checkpoints/ShadowCheckpointService.ts @@ -77,7 +77,9 @@ export class ShadowCheckpointService implements CheckpointService { .map((line) => line.split(" ")[0].trim()) } } catch (error) { - console.warn(`Failed to read .gitattributes: ${error instanceof Error ? error.message : String(error)}`) + this.log( + `[initShadowGit] failed to read .gitattributes: ${error instanceof Error ? error.message : String(error)}`, + ) } // Add basic excludes directly in git config, while respecting any @@ -101,7 +103,7 @@ export class ShadowCheckpointService implements CheckpointService { try { await this.git.add(".") } catch (error) { - console.error(`Failed to add files to git: ${error instanceof Error ? error.message : String(error)}`) + this.log(`[stageAll] failed to add files to git: ${error instanceof Error ? error.message : String(error)}`) } finally { await this.renameNestedGitRepos(false) } @@ -149,7 +151,7 @@ export class ShadowCheckpointService implements CheckpointService { try { this.shadowGitConfigWorktree = (await this.git.getConfig("core.worktree")).value || undefined } catch (error) { - console.error( + this.log( `[getShadowGitConfigWorktree] failed to get core.worktree: ${error instanceof Error ? error.message : String(error)}`, ) } @@ -172,7 +174,7 @@ export class ShadowCheckpointService implements CheckpointService { return undefined } } catch (error) { - console.error( + this.log( `[saveCheckpoint] failed to create checkpoint: ${error instanceof Error ? error.message : String(error)}`, ) @@ -209,7 +211,7 @@ export class ShadowCheckpointService implements CheckpointService { const after = to ? await this.git.show([`${to}:${relPath}`]).catch(() => "") - : await fs.readFile(relPath, "utf8").catch(() => "") + : await fs.readFile(absPath, "utf8").catch(() => "") result.push({ paths: { relative: relPath, absolute: absPath }, content: { before, after } }) }