Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg/diff/run.go: reset worktree after loading packages #2

Merged
merged 1 commit into from
Jun 11, 2020

Conversation

joelanford
Copy link
Owner

After loading Go packages, the go.mod and go.sum files are sometimes modified.
This causes subsequent checkouts of other commits to fail, which results in
the command failing to produce API differences.

This commit performs a hard reset on the worktree after the packages have been
loaded so that subsequent checkouts succeed. This should be safe because
go-apidiff checks to ensure that the tree is clean when the program starts.

After loading Go packages, the go.mod and go.sum files are sometimes modified.
This causes subsequent checkouts of other commits to fail, which results in
the command failing to produce API differences.

This commit performs a hard reset on the worktree after the packages have been
loaded so that subsequent checkouts succeed. This should be safe because
go-apidiff checks to ensure that the tree is clean when the program starts.
@joelanford
Copy link
Owner Author

@alexeldeib @vincepri

Since you all helped get this added to CI for kubernetes-sigs/controller-runtime and kubernetes-sigs/cluster-api, just wanted a quick sanity check of this from you.

This solves some problems I've been having doing comparisons of other kubernetes libs (e.g. client-go)

@vincepri
Copy link

Should we make this opt-in? If folks run this locally with changes in the tree, we might overwrite their changes.

@joelanford
Copy link
Owner Author

@vincepri Before doing any moving around in the repo, we already check to make sure the tree is clean.

That check should be forcing folks to have a clean tree before running this command.

@vincepri
Copy link

Makes sense

@joelanford joelanford merged commit 1ae45eb into master Jun 11, 2020
@joelanford joelanford deleted the git-reset branch June 11, 2020 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants