Add support for creating a registry repo with an initial branch other than master. #58
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.
When an origin repo for a registry is created, it may use a branch name other than
master(e.g., GitHub now defaults tomain). When LocalRegistry creates a registry (e.g. in~/.julia/registries/...), it may use an inconsistent initial branch name, leading to errors on the first attempt to push. This PR adds an option for the initial branch name.I tested this by creating a local repo as my "origin" (
git init --initial-branch=main --bare .) and then using LocalRegistry to create a new registry usingmainas the initial branch andfile://...as the URL (create_registry("InitBranchTest5", "file:///Users/tucker/Dev/loreg/", branch = "main", push = true)). This pushed correctly and appears to have done the right thing.It still needs CI testing, so this is a draft PR so folks can provide feedback.
Possible improvements:
--initial-branchoption will only work on git version 2.28.0, according to the same Stack Exchange. Perhaps this would be done aftergit initwithgit checkout -b $branch.git config --global init.defaultBranchis suggested by this Stack Exchange, but it doesn't appear to work on my machine, so I didn't add a feature for this.)