mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
force
This commit is contained in:
parent
cfa4f28c28
commit
4ee81be180
2 changed files with 3 additions and 3 deletions
|
|
@ -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) => {
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue