Skip to content

Respect remote default branch name on vanilla Git clone#449

Merged
mjcheetham merged 1 commit intomicrosoft:mainfrom
mjcheetham:fix-remotehead
Oct 15, 2020
Merged

Respect remote default branch name on vanilla Git clone#449
mjcheetham merged 1 commit intomicrosoft:mainfrom
mjcheetham:fix-remotehead

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!

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