git-sync-web 自动提交 2026-09-09 14:09:32

This commit is contained in:
tamakyi
2026-09-09 14:09:33 +08:00
parent f161424dcd
commit ab249cbf7f
9 changed files with 4 additions and 39 deletions
-14
View File
@@ -1,14 +0,0 @@
# Git 自动同步配置 - demo
REPO_PATH="C:/OtherFiles/Github/git-auto-sync/git-sync-web/_smoke/repo"
BRANCH="main"
REMOTES="origin=https://example.invalid/x.git"
MODE="both"
INTERVAL="60"
LOG_FILE=""
AUTH_METHOD="https"
RETRY_COUNT="0"
RETRY_INTERVAL="0"
CONFLICT_STRATEGY="merge"
PUSH_STRATEGY="manual"
AUTO_COMMIT="0"
CRON=""
-5
View File
@@ -1,5 +0,0 @@
[2026-09-09 13:51:38] [info] 配置已创建(路径 C:/OtherFiles/Github/git-auto-sync/git-sync-web/_smoke/repo)
[2026-09-09 13:51:43] [info] 监控已启动
[2026-09-09 13:51:43] [info] 已添加远程 origin → https://example.invalid/x.git
[2026-09-09 13:51:44] [info] === 开始同步(启动检查,模式 both)===
[2026-09-09 13:51:45] [error] fetch 失败: fatal: unable to access 'https://example.invalid/x.git/': CONNECT tunnel failed, response 502
Submodule _smoke/repo deleted from 39a01d89da
-1
View File
@@ -1 +0,0 @@
2026/09/09 13:50:57 Git Sync Web 已启动: http://127.0.0.1:5831(鉴权:false)
-14
View File
@@ -1,14 +0,0 @@
# Git 自动同步配置 - demo
REPO_PATH="C:/OtherFiles/Github/git-auto-sync/git-sync-web/_smoke2/repo"
BRANCH="main"
REMOTES="origin=https://example.invalid/x.git"
MODE="both"
INTERVAL="60"
LOG_FILE=""
AUTH_METHOD="https"
RETRY_COUNT="0"
RETRY_INTERVAL="0"
CONFLICT_STRATEGY="merge"
PUSH_STRATEGY="manual"
AUTO_COMMIT="0"
CRON=""
-1
View File
@@ -1 +0,0 @@
[2026-09-09 13:55:33] [info] 配置已创建(路径 C:/OtherFiles/Github/git-auto-sync/git-sync-web/_smoke2/repo)
Submodule _smoke2/repo deleted from e7bbd5cce2
-1
View File
@@ -1 +0,0 @@
2026/09/09 13:54:59 Git Sync Web 已启动: http://127.0.0.1:5832(鉴权:false)
+4 -1
View File
@@ -37,7 +37,10 @@ func gitRun(repoPath string, timeout time.Duration, args ...string) (string, err
cmd.Stdout = &outBuf cmd.Stdout = &outBuf
cmd.Stderr = &errBuf cmd.Stderr = &errBuf
err := cmd.Run() err := cmd.Run()
out := strings.TrimSpace(outBuf.String()) // 只裁剪尾部空白,不要用 TrimSpace 裁整体:
// git 输出首行的前导空格具有语义(status --porcelain 的暂存位、diff 的上下文行),
// 整体 TrimSpace 会把它吃掉,导致按固定偏移解析路径时错位。
out := strings.TrimRight(outBuf.String(), "\r\n\t ")
if err != nil { if err != nil {
if ctx.Err() == context.DeadlineExceeded { if ctx.Err() == context.DeadlineExceeded {
return out, fmt.Errorf("命令超时: git %s", strings.Join(args, " ")) return out, fmt.Errorf("命令超时: git %s", strings.Join(args, " "))