Skip to content

Commit 88e3662

Browse files
authored
Merge pull request #965 from RooVetGit/cte/logging-tweaks
Checkpoints logging tweaks
2 parents 97ed646 + 7de31e1 commit 88e3662

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/services/checkpoints/ShadowCheckpointService.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ export class ShadowCheckpointService implements CheckpointService {
7777
.map((line) => line.split(" ")[0].trim())
7878
}
7979
} catch (error) {
80-
console.warn(`Failed to read .gitattributes: ${error instanceof Error ? error.message : String(error)}`)
80+
this.log(
81+
`[initShadowGit] failed to read .gitattributes: ${error instanceof Error ? error.message : String(error)}`,
82+
)
8183
}
8284

8385
// Add basic excludes directly in git config, while respecting any
@@ -101,7 +103,7 @@ export class ShadowCheckpointService implements CheckpointService {
101103
try {
102104
await this.git.add(".")
103105
} catch (error) {
104-
console.error(`Failed to add files to git: ${error instanceof Error ? error.message : String(error)}`)
106+
this.log(`[stageAll] failed to add files to git: ${error instanceof Error ? error.message : String(error)}`)
105107
} finally {
106108
await this.renameNestedGitRepos(false)
107109
}
@@ -149,7 +151,7 @@ export class ShadowCheckpointService implements CheckpointService {
149151
try {
150152
this.shadowGitConfigWorktree = (await this.git.getConfig("core.worktree")).value || undefined
151153
} catch (error) {
152-
console.error(
154+
this.log(
153155
`[getShadowGitConfigWorktree] failed to get core.worktree: ${error instanceof Error ? error.message : String(error)}`,
154156
)
155157
}
@@ -172,7 +174,7 @@ export class ShadowCheckpointService implements CheckpointService {
172174
return undefined
173175
}
174176
} catch (error) {
175-
console.error(
177+
this.log(
176178
`[saveCheckpoint] failed to create checkpoint: ${error instanceof Error ? error.message : String(error)}`,
177179
)
178180

@@ -209,7 +211,7 @@ export class ShadowCheckpointService implements CheckpointService {
209211

210212
const after = to
211213
? await this.git.show([`${to}:${relPath}`]).catch(() => "")
212-
: await fs.readFile(relPath, "utf8").catch(() => "")
214+
: await fs.readFile(absPath, "utf8").catch(() => "")
213215

214216
result.push({ paths: { relative: relPath, absolute: absPath }, content: { before, after } })
215217
}

0 commit comments

Comments
 (0)