Skip to content

Stop relying on an empty default branch

James Fargher requested to merge remote_empty_default into master

Part of #1446

GetDefaultBranch with the current heuristic will return an empty string on a repo with no branches. In reality, HEAD will be set to something, an unborn branch. This means when we switch GetDefaultBranch to only read HEAD instead of the heuristic the behaviour will change.

To mitigate this issue I've gone through all the internal uses of GetDefaultBranch to check if we are relying on it returning an empty string.

This MR additionally converts the changed codes tests to use our default branch constants. All tests that rely on default branch and are generating repos on the fly (rather than the seed repo) should be using these.

Edited by James Fargher

Merge request reports