git-sync-web 自动提交 2026-09-08 17:33:08

This commit is contained in:
tamakyi
2026-09-08 17:33:08 +08:00
parent be99e73a0e
commit 18dbd34f2c
3 changed files with 15 additions and 0 deletions
+7
View File
@@ -594,6 +594,13 @@ func (e *Engine) syncOnce(s *repoState, trigger string) {
s.mu.Unlock()
e.pushStatus(s)
if ahead > 0 && (cfg.Mode == "push" || cfg.Mode == "both") {
if !e.pushAll(s, cfg, ahead) {
// 推送失败,本轮终止,避免继续拉取加剧分叉
e.setFail(s, "推送失败,本轮同步已终止(跳过拉取以避免分叉加剧)")
return
}
}
if behind > 0 && (cfg.Mode == "pull" || cfg.Mode == "both") {
if !e.pullRemote(s, cfg, remote, behind) {
return
+7
View File
@@ -80,3 +80,10 @@ error: failed to push some refs to 'https://git.shiroko.one/tamakyi/github-auto-
[2026-09-08 17:30:43] === 同步完成(本地领先 0,落后 0)===
[2026-09-08 17:31:43] === 开始同步(定时检查,模式 push)===
[2026-09-08 17:31:51] 检测到 4 个未提交改动,执行自动提交
[2026-09-08 17:31:54] 自动提交完成,将随本轮同步推送
[2026-09-08 17:31:56] 远程分支 origin/main 不存在(远程仓库可能为空或分支名不一致),将推送本地 12 个提交以建立远程分支
[2026-09-08 17:31:58] 推送至 origin 失败: error: src refspec main does not match any
error: failed to push some refs to 'https://git.shiroko.one/tamakyi/github-auto-sync-golang'
[2026-09-08 17:31:59] === 同步完成(本地领先 0,落后 0)===
[2026-09-08 17:32:59] === 开始同步(定时检查,模式 push)===
[2026-09-08 17:33:07] 检测到 3 个未提交改动,执行自动提交
+1
View File
@@ -10,3 +10,4 @@ timestamp,action,result,commits
2026-09-08 17:27:05,push,failed,9
2026-09-08 17:28:21,push,failed,10
2026-09-08 17:30:42,push,failed,11
2026-09-08 17:31:58,push,failed,12
1 timestamp action result commits
10 2026-09-08 17:27:05 push failed 9
11 2026-09-08 17:28:21 push failed 10
12 2026-09-08 17:30:42 push failed 11
13 2026-09-08 17:31:58 push failed 12