fix(open): clone the branch given in ref - #41
Merged
Merged
Conversation
`M.open` resolved a ref from both `ref` and the parsed URI, but the clone
call only received `parsed_repo.branch`. Calling `open(repo, { branch = "x" })`
with a URI that carries no branch therefore cloned without `-b`, and since
the default `clone_args` include `--single-branch`, no remote-tracking ref
for "x" was ever fetched. The post-clone checkout then failed and the
repository was left on the default branch.
Pass `ref.branch or ref.tag` to the clone, falling back to the parsed URI
as before.
Owner
|
Thanks. |
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.
M.openresolves a ref from bothrefand the parsed URI, but the clone call only receivedparsed_repo.branch.So
open("owner/repo", { branch = "x" })clones without-b. With--single-branchin the defaultclone_args, no ref forxis fetched, the post-clonegit checkout xfails, and the repo is left on the default branch — silently, unlessverbose = true. The URI form (/tree/x) is unaffected.Fix: pass
ref.branch or ref.tag or parsed_repo.branch.-btakes branches and tags;ref.commitstill goes through the post-clone checkout, as before.