mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-10-10 03:28:03 +00:00
initial print fix
This commit is contained in:
parent
0872b8b044
commit
6044c1af74
1 changed files with 10 additions and 1 deletions
|
|
@ -20,6 +20,7 @@ export abstract class ShadowCheckpointService extends EventEmitter {
|
|||
|
||||
protected _checkpoints: string[] = []
|
||||
protected _baseHash?: string
|
||||
protected _hasFirstCheckpoint: boolean = false
|
||||
|
||||
protected readonly dotGitDir: string
|
||||
protected git?: SimpleGit
|
||||
|
|
@ -93,6 +94,11 @@ export abstract class ShadowCheckpointService extends EventEmitter {
|
|||
|
||||
await this.writeExcludeFile()
|
||||
this.baseHash = await git.revparse(["HEAD"])
|
||||
// Check if there are any commits beyond the initial commit
|
||||
const commits = await git.log()
|
||||
if (commits.total > 0) {
|
||||
this._hasFirstCheckpoint = true
|
||||
}
|
||||
} else {
|
||||
this.log(`[${this.constructor.name}#initShadowGit] creating shadow git repo at ${this.checkpointsDir}`)
|
||||
await git.init()
|
||||
|
|
@ -211,7 +217,7 @@ export abstract class ShadowCheckpointService extends EventEmitter {
|
|||
await this.stageAll(this.git)
|
||||
const commitArgs = options?.allowEmpty ? { "--allow-empty": null } : undefined
|
||||
const result = await this.git.commit(message, commitArgs)
|
||||
const isFirst = this._checkpoints.length === 0
|
||||
const isFirst = !this._hasFirstCheckpoint
|
||||
const fromHash = this._checkpoints[this._checkpoints.length - 1] ?? this.baseHash!
|
||||
const toHash = result.commit || fromHash
|
||||
this._checkpoints.push(toHash)
|
||||
|
|
@ -219,6 +225,9 @@ export abstract class ShadowCheckpointService extends EventEmitter {
|
|||
|
||||
if (isFirst || result.commit) {
|
||||
this.emit("checkpoint", { type: "checkpoint", isFirst, fromHash, toHash, duration })
|
||||
if (isFirst) {
|
||||
this._hasFirstCheckpoint = true
|
||||
}
|
||||
}
|
||||
|
||||
if (result.commit) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue