microsoft / scalar

Scalar: A set of tools and extensions for Git to allow very large monorepos to run on Git without a virtualization layer
MIT License
1.39k stars 63 forks source link

Respect remote default branch name on vanilla Git clone #449

Closed mjcheetham closed 4 years ago

mjcheetham commented 4 years ago

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

derrickstolee commented 4 years ago

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!