Fix issue where branch checkout did not have accurate git tree state (issue #567)#569
Merged
jessesuen merged 1 commit intoargoproj:masterfrom Sep 10, 2018
Merged
Conversation
5b5fc99 to
4e31099
Compare
4e31099 to
72cc4cc
Compare
6 tasks
alexmt
approved these changes
Sep 10, 2018
jessesuen
added a commit
that referenced
this pull request
Sep 10, 2018
leoluz
pushed a commit
to leoluz/argo-cd
that referenced
this pull request
Mar 13, 2025
…oj#568) (argoproj#569) Signed-off-by: Jonathan West <jonwest@redhat.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change refactors the checkout logic such that git checkout always checks out an explicit git commit SHA, instead of an ambiguous ref name. This is possible because we always perform a git ls-remote to resolve to a SHA-1, which we can then pass to the checkout method.
A second benefit of this approach is that the checkout always is performed in a detached HEAD mode, which leaves the git repository in a state where it never has any local branches. This negates the need to "reset" our git repository (and delete local branches) as part of every repo server call.