🎨 When rolling back a snapshot, a snapshot is created for the current data by default https://github.com/siyuan-note/siyuan/issues/12470

This commit is contained in:
Daniel 2024-09-13 22:47:29 +08:00
parent 5de78d837d
commit a2cf233aef
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -639,6 +639,16 @@ func checkoutRepo(id string) {
Conf.Sync.Enabled = false
Conf.Save()
// 回滚快照时默认为当前数据创建一个快照
// When rolling back a snapshot, a snapshot is created for the current data by default https://github.com/siyuan-note/siyuan/issues/12470
_, err = repo.Index("Backup before checkout", map[string]interface{}{eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBarAndProgress})
if err != nil {
logging.LogErrorf("index repository failed: %s", err)
util.PushClearProgress()
util.PushErrMsg(fmt.Sprintf(Conf.Language(140), err), 0)
return
}
_, _, err = repo.Checkout(id, map[string]interface{}{eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBarAndProgress})
if err != nil {
logging.LogErrorf("checkout repository failed: %s", err)