Skip to content

Commit

Permalink
fix: Use force checkouts in git artifact. Fixes #14141
Browse files Browse the repository at this point in the history
Avoids worktree contains unstaged changes error

Signed-off-by: David Gamba <[email protected]>
  • Loading branch information
DavidGamba committed Feb 3, 2025
1 parent 5f2f57c commit bff2faa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion workflow/artifacts/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func (g *ArtifactDriver) Load(inputArtifact *wfv1.Artifact, path string) error {
if err != nil {
return fmt.Errorf("failed to get resolve revision: %w", err)
}
if err := w.Checkout(&git.CheckoutOptions{Hash: plumbing.NewHash(h.String())}); err != nil {
if err := w.Checkout(&git.CheckoutOptions{Hash: plumbing.NewHash(h.String()), Force: true}); err != nil {
return fmt.Errorf("failed to checkout %q: %w", h, err)
}
}
Expand Down

0 comments on commit bff2faa

Please sign in to comment.