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

Fix tag checkout with libgit2 #394

Merged
merged 1 commit into from
Jun 29, 2021
Merged

Fix tag checkout with libgit2 #394

merged 1 commit into from
Jun 29, 2021

Conversation

bburky
Copy link

@bburky bburky commented Jun 29, 2021

SetHeadDetached (git_repository_set_head_detached) only changes HEAD, and does not actually checkout the files on disk. Use CheckoutHead with the CheckoutForce Strategy to actually check the files out on disk.

Additionally add a test that validates the hash of a checked out file's contents.

Previously, the hash of the desired tag was being reported as the checked out revision by the GitRepository. However the wrong files were checked out and an incorrect revision would be deployed by Flux.

(I'm not a go expert, please feel free to suggest edits to any of the code.)

SetHeadDetached (git_repository_set_head_detached) only changes HEAD,
and does not actually checkout the files on disk. Use CheckoutHead with
the CheckoutForce Strategy to actually check the files out on disk.

Additionally add a test that validates the hash of a checked out file's
contents.

Previously, the hash of the desired tag was being reported as the
checked out revision by the GitRepository. However the wrong files were
checked out and an incorrect revision would be deployed by Flux.

Signed-off-by: Blake Burkhart <blake.burkhart@us.af.mil>
Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thanks @bburky 🥇

@stefanprodan stefanprodan added area/git Git related issues and pull requests bug Something isn't working labels Jun 29, 2021
@stefanprodan stefanprodan merged commit 887d2c5 into fluxcd:main Jun 29, 2021
@bburky bburky deleted the libgit2-tag-checkout branch June 29, 2021 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/git Git related issues and pull requests bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants