feat(infra/git): clone/fetch/push/commit/status verbs + integration tests

This commit is contained in:
2026-05-01 21:43:56 +08:00
parent f8c7771892
commit faecb05ebd
10 changed files with 280 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
package git
import "context"
// Push 推送 dir 当前 branch 到 origin/<branch>。
func (r *DefaultRunner) Push(ctx context.Context, dir, branch string, cred *Credential) error {
ctx, cancel := withCtx(ctx, r.cfg.PushTimeout)
defer cancel()
env, cleanup, err := credentialEnv(r.cfg.TmpDir, cred)
if err != nil {
return err
}
defer cleanup()
_, _, err = r.exec(ctx, dir, env, "push", "-u", "origin", branch)
return err
}