diff --git a/internal/source/gitlab/gitlab.go b/internal/source/gitlab/gitlab.go index 64aabdf..abf8ef7 100644 --- a/internal/source/gitlab/gitlab.go +++ b/internal/source/gitlab/gitlab.go @@ -145,7 +145,7 @@ func (g *Gitlab) RequestOpen(ctx context.Context, branch string, path string, mo if err != nil { logger.Fatal(ctx, fmt.Sprintf("failed to get worktree: %v", err)) } - defer checkout(wtree, *g.baseRef) + defer checkout(*wtree, *g.baseRef) g.pulls, err = GetPulls(ctx, g.URL, g.Owner, g.Repository, g.Password) if err != nil { @@ -455,12 +455,14 @@ func GetPulls(ctx context.Context, url, projectId, branch, password string) ([]* } } -func checkout(w *git.Worktree, ref plumbing.Reference) { +func checkout(w git.Worktree, ref plumbing.Reference) { ctx := context.Background() logger.Debug(ctx, fmt.Sprintf("Checkout: %s", ref.Name().Short())) if err := w.Checkout(&git.CheckoutOptions{ Branch: ref.Name(), + Force: true, + Keep: false, }); err != nil { logger.Error(ctx, fmt.Sprintf("failed to reset: %v", err)) }