This commit is contained in:
Dax Raad 2025-07-22 18:24:48 -04:00
parent cfa4f28c28
commit 4ee81be180
2 changed files with 3 additions and 3 deletions

View file

@ -1075,7 +1075,7 @@ export namespace Session {
if ((msg.info.id === input.messageID && !input.partID) || part.id === input.partID) {
// if no useful parts left in message, same as reverting whole message
const partID = remaining.some((item) => ["text", "tool"].includes(item.type)) ? input.partID : undefined
const snapshot = session.revert?.snapshot ?? (await Snapshot.create(input.sessionID))
const snapshot = session.revert?.snapshot ?? (await Snapshot.create(input.sessionID, true))
log.info("revert snapshot", { snapshot })
if (lastSnapshot) await Snapshot.restore(input.sessionID, lastSnapshot.snapshot)
const next = await update(input.sessionID, (draft) => {

View file

@ -8,7 +8,7 @@ import { Log } from "../util/log"
export namespace Snapshot {
const log = Log.create({ service: "snapshot" })
export async function create(sessionID: string) {
export async function create(sessionID: string, force?: boolean) {
log.info("creating snapshot")
const app = App.info()
@ -40,7 +40,7 @@ export namespace Snapshot {
log.info("added files")
const result =
await $`git --git-dir ${git} commit -m "snapshot" --no-gpg-sign --author="opencode <mail@opencode.ai>"`
await $`git --git-dir ${git} commit ${force ? "--allow-empty" : ""} -m "snapshot" --no-gpg-sign --author="opencode <mail@opencode.ai>"`
.quiet()
.cwd(app.path.cwd)
.nothrow()