🎨 自动校验索引时排除非 id 格式的 .sy 文件 Fix https://github.com/siyuan-note/siyuan/issues/7111
This commit is contained in:
parent
519f015498
commit
c87bb94a60
2 changed files with 23 additions and 0 deletions
|
@ -501,6 +501,8 @@ func InitRepoKey() (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var isCheckoutRepo bool
|
||||||
|
|
||||||
func CheckoutRepo(id string) (err error) {
|
func CheckoutRepo(id string) (err error) {
|
||||||
if 1 > len(Conf.Repo.Key) {
|
if 1 > len(Conf.Repo.Key) {
|
||||||
err = errors.New(Conf.Language(26))
|
err = errors.New(Conf.Language(26))
|
||||||
|
@ -523,6 +525,16 @@ func CheckoutRepo(id string) (err error) {
|
||||||
Conf.Sync.Enabled = false
|
Conf.Sync.Enabled = false
|
||||||
Conf.Save()
|
Conf.Save()
|
||||||
|
|
||||||
|
if util.IsMutexLocked(&syncLock) {
|
||||||
|
err = errors.New("Sync is running, please try again later")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
isCheckoutRepo = true
|
||||||
|
defer func() {
|
||||||
|
isCheckoutRepo = false
|
||||||
|
}()
|
||||||
|
|
||||||
_, _, err = repo.Checkout(id, map[string]interface{}{eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBarAndProgress})
|
_, _, err = repo.Checkout(id, map[string]interface{}{eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBarAndProgress})
|
||||||
if nil != err {
|
if nil != err {
|
||||||
util.PushClearProgress()
|
util.PushClearProgress()
|
||||||
|
|
|
@ -1244,6 +1244,11 @@ func autoFixIndex() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if isCheckoutRepo {
|
||||||
|
logging.LogInfof("skip check index caused by checkout repo")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if util.IsMutexLocked(&autoFixLock) {
|
if util.IsMutexLocked(&autoFixLock) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1286,6 +1291,12 @@ func autoFixIndex() {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
id := path.Base(p)
|
||||||
|
id = strings.TrimSuffix(id, ".sy")
|
||||||
|
if !ast.IsNodeIDPattern(id) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
reindexTreeByPath(box.ID, p, i, size)
|
reindexTreeByPath(box.ID, p, i, size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue