git-sync-web 自动提交 2026-09-09 15:39:21

This commit is contained in:
tamakyi
2026-09-09 15:39:22 +08:00
parent 4232da5ced
commit 5cdffecb44
5 changed files with 46 additions and 19 deletions
+10
View File
@@ -75,6 +75,7 @@ type RepoSnapshot struct {
PushStrategy string `json:"push_strategy"`
LogFile string `json:"log_file"`
AutoCommit bool `json:"auto_commit"`
AutoSync bool `json:"auto_sync"`
Cron string `json:"cron"`
Remotes []Remote `json:"remotes"`
Running bool `json:"running"`
@@ -273,6 +274,7 @@ func (s *repoState) snapshot(live bool) RepoSnapshot {
PushStrategy: cfg.PushStrategy,
LogFile: cfg.LogFile,
AutoCommit: cfg.AutoCommit,
AutoSync: cfg.AutoSync,
Cron: cfg.Cron,
Remotes: cfg.Remotes,
Running: s.running,
@@ -350,7 +352,15 @@ func (e *Engine) loop(s *repoState, stopCh chan struct{}) {
s.mu.Lock()
interval := s.cfg.Interval
cronStr := s.cfg.Cron
autoSync := s.cfg.AutoSync
s.mu.Unlock()
// 自动同步关闭:不再自动触发,仅保留监控与手动同步能力
if !autoSync {
e.logf(s, "info", "已关闭自动同步,仅响应手动同步")
e.pushStatus(s)
<-stopCh
return
}
if interval < 5 {
interval = 5
}