diff --git a/_smoke/base/configs/demo.conf b/_smoke/base/configs/demo.conf deleted file mode 100644 index 0ecf185..0000000 --- a/_smoke/base/configs/demo.conf +++ /dev/null @@ -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="" diff --git a/_smoke/base/logs/demo.log b/_smoke/base/logs/demo.log deleted file mode 100644 index f0e389e..0000000 --- a/_smoke/base/logs/demo.log +++ /dev/null @@ -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 diff --git a/_smoke/repo b/_smoke/repo deleted file mode 160000 index 39a01d8..0000000 --- a/_smoke/repo +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 39a01d89da349508c5f3fdf60ae480745f41efa0 diff --git a/_smoke/server.log b/_smoke/server.log deleted file mode 100644 index 5085d0b..0000000 --- a/_smoke/server.log +++ /dev/null @@ -1 +0,0 @@ -2026/09/09 13:50:57 Git Sync Web 已启动: http://127.0.0.1:5831(鉴权:false) diff --git a/_smoke2/base/configs/demo.conf b/_smoke2/base/configs/demo.conf deleted file mode 100644 index 330b0cd..0000000 --- a/_smoke2/base/configs/demo.conf +++ /dev/null @@ -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="" diff --git a/_smoke2/base/logs/demo.log b/_smoke2/base/logs/demo.log deleted file mode 100644 index bdeb821..0000000 --- a/_smoke2/base/logs/demo.log +++ /dev/null @@ -1 +0,0 @@ -[2026-09-09 13:55:33] [info] 配置已创建(路径 C:/OtherFiles/Github/git-auto-sync/git-sync-web/_smoke2/repo) diff --git a/_smoke2/repo b/_smoke2/repo deleted file mode 160000 index e7bbd5c..0000000 --- a/_smoke2/repo +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e7bbd5cce2e657817cedfa2bbf0eecd81ed8b450 diff --git a/_smoke2/server.log b/_smoke2/server.log deleted file mode 100644 index 01375f7..0000000 --- a/_smoke2/server.log +++ /dev/null @@ -1 +0,0 @@ -2026/09/09 13:54:59 Git Sync Web 已启动: http://127.0.0.1:5832(鉴权:false) diff --git a/git.go b/git.go index 9fb8dc0..5c90419 100644 --- a/git.go +++ b/git.go @@ -37,7 +37,10 @@ func gitRun(repoPath string, timeout time.Duration, args ...string) (string, err cmd.Stdout = &outBuf cmd.Stderr = &errBuf 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 ctx.Err() == context.DeadlineExceeded { return out, fmt.Errorf("命令超时: git %s", strings.Join(args, " "))