Skip to content

Commit 5da7e35

Browse files
corneliusweigk8s-ci-robot
authored andcommitted
Ensure index updates do not fail if the local and remote history diverge (#202)
1 parent 6597914 commit 5da7e35

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/gitutil/git.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ func IsGitCloned(gitPath string) (bool, error) {
4747

4848
// update will fetch origin and set HEAD to origin/HEAD.
4949
func update(destinationPath string) error {
50-
return exec(destinationPath, "pull", "--ff-only", "-v")
50+
if err := exec(destinationPath, "fetch", "-v"); err != nil {
51+
return errors.Wrapf(err, "fetch index at %q failed", destinationPath)
52+
}
53+
54+
err := exec(destinationPath, "reset", "--hard", "@{upstream}")
55+
return errors.Wrapf(err, "reset index at %q failed", destinationPath)
5156
}
5257

5358
// EnsureUpdated will ensure the destination path exists and is up to date.

0 commit comments

Comments
 (0)