You've already forked agentic-coding-workflow
feat(infra/git): clone/fetch/push/commit/status verbs + integration tests
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package git
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// Clone 把 remoteURL 上的 branch 浅克隆到 dst。dst 不能预先存在。
|
||||
func (r *DefaultRunner) Clone(ctx context.Context, dst, remoteURL, branch string, cred *Credential) error {
|
||||
ctx, cancel := withCtx(ctx, r.cfg.CloneTimeout)
|
||||
defer cancel()
|
||||
env, cleanup, err := credentialEnv(r.cfg.TmpDir, cred)
|
||||
if err != nil {
|
||||
return fmt.Errorf("credential env: %w", err)
|
||||
}
|
||||
defer cleanup()
|
||||
args := []string{"clone", "--branch", branch, "--single-branch", remoteURL, dst}
|
||||
_, _, err = r.exec(ctx, "", env, args...)
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user