feat(VCS): auto-commit hooked up to all changeful commands

This commit is contained in:
Lewis Wynne 2025-12-18 20:57:54 +00:00
parent 63e2cc55a0
commit 9506a2b657
6 changed files with 112 additions and 14 deletions

View file

@ -142,17 +142,23 @@ func mv(cmd *cobra.Command, args []string) error {
}
if copy {
return nil
msg := fmt.Sprintf("cp %s -> %s", fromSpec.Display(), toSpec.Display())
return autoCommit(store, []string{fromSpec.DB, toSpec.DB}, msg)
}
return store.Transaction(TransactionArgs{
if err := store.Transaction(TransactionArgs{
key: fromRef,
readonly: false,
sync: false,
transact: func(tx *badger.Txn, k []byte) error {
return tx.Delete(k)
},
})
}); err != nil {
return err
}
msg := fmt.Sprintf("mv %s -> %s", fromSpec.Display(), toSpec.Display())
return autoCommit(store, []string{fromSpec.DB, toSpec.DB}, msg)
}
var (