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

Respect remote default branch name on vanilla Git clone #449

Merged
merged 1 commit into from
Oct 15, 2020

Conversation

mjcheetham
Copy link
Member

@mjcheetham mjcheetham commented Oct 15, 2020

Attempt to determine the remote's default branch name when performing a scalar clone using the vanilla Git protocols (not using the GVFS helper).

Use ls-remote to lookup the HEAD ref on the remote, and parse the results. If the remote's HEAD is not a branch, or we fail to parse the output for any reason, consult Git itself for the default branch name as a fallback.

Scalar clones using the GVFS protocol & helper work differently, and already take the default remote branch name from the manual call to /info/refs?service=git-upload-pack.

Fixes #438

Copy link
Member

@dscho dscho left a comment

Choose a reason for hiding this comment

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

I only had one minor suggestion, and would even be fine with the PR as-is.

@derrickstolee
Copy link
Contributor

Scalar clones using the GVFS protocol & helper work differently, and already take the default remote branch name from the manual call to /info/refs?service=git-upload-pack.

Ah! This is why this has worked for the Windows and Office customers. Thanks for discovering this!

Verified

This commit was signed with the committer’s verified signature.
mjcheetham Matthew John Cheetham
Attempt to determine the remote's default branch name when performing a
`scalar clone` using the vanilla Git protocols (not using the GVFS helper).

Use ls-remote to lookup the HEAD ref on the remote, and parse the
results. If the remote's HEAD is not a branch, or we fail to parse the
output for any reason, consult Git itself for the default branch name as
a fallback.
@mjcheetham mjcheetham merged commit 3d83058 into microsoft:main Oct 15, 2020
@mjcheetham mjcheetham deleted the fix-remotehead branch October 15, 2020 15:09
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.

scalar clone fails if default branch is changed
3 participants