with action creator
This commit is contained in:
@@ -70,7 +70,7 @@ func (g *Git) Clone(ctx context.Context, storageArea *storage.Area, repoUrl stri
|
||||
Auth: auth,
|
||||
RemoteName: "origin",
|
||||
ReferenceName: "refs/heads/main",
|
||||
SingleBranch: true,
|
||||
SingleBranch: false,
|
||||
NoCheckout: false,
|
||||
Depth: 1,
|
||||
RecurseSubmodules: 1,
|
||||
@@ -90,6 +90,21 @@ func (g *Git) Clone(ctx context.Context, storageArea *storage.Area, repoUrl stri
|
||||
return &GitRepo{repo: repo}, nil
|
||||
}
|
||||
|
||||
func (g *Git) Checkout(ctx context.Context, gitRepo *GitRepo, branch string) error {
|
||||
wt, err := gitRepo.repo.Worktree()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return wt.Checkout(&git.CheckoutOptions{
|
||||
Hash: [20]byte{},
|
||||
Branch: plumbing.NewBranchReferenceName(branch),
|
||||
Create: false,
|
||||
Force: false,
|
||||
Keep: false,
|
||||
})
|
||||
}
|
||||
|
||||
func (g *Git) getProgressWriter() *zapio.Writer {
|
||||
return &zapio.Writer{
|
||||
Log: g.logger.With(zap.String("process", "go-git")),
|
||||
|
Reference in New Issue
Block a user