Allow overriding the default name of the default branch by dscho · Pull Request #656 · gitgitgadget/git (original) (raw)
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
[](/apps/gitgitgadget)
[](/apps/gitgitgadget)
[](/apps/gitgitgadget)
[](/apps/gitgitgadget)
[](/apps/gitgitgadget)
[](/apps/gitgitgadget)
[](/apps/gitgitgadget)
[](/apps/gitgitgadget)
dscho mentioned this pull request
Don Goodman-Wilson and others added 4 commits
…onfig
We just introduced the command-line option
--initial-branch=<branch-name>
to allow initializing a new repository
with a different initial branch than the hard-coded one.
To allow users to override the initial branch name more permanently
(i.e. without having to specify the name manually for each and every
git init
invocation), let's introduce the init.defaultBranch
config
setting.
Helped-by: Johannes Schindelin johannes.schindelin@gmx.de Helped-by: Derrick Stolee dstolee@microsoft.com Signed-off-by: Don Goodman-Wilson don@goodman-wilson.com
When cloning a repository without any branches, Git chooses a default branch name for the as-yet unborn branch.
As part of the implicit initialization of the local repository, Git just
learned to respect init.defaultBranch
to choose a different initial
branch name. We now really want that branch name to be used as a
fall-back.
Signed-off-by: Johannes Schindelin johannes.schindelin@gmx.de
When guessing the default branch name of a remote, and there are no refs to guess from, we want to go with the preference specified by the user for the fall-back, i.e. the default name to be used for the initial branch of new repositories (because as far as the user is concerned, a remote that has no branches yet is a new repository).
At the same time, when talking to an older Git server that does not
report a symref for HEAD
(but instead reports a commit hash), let's
try to guess the configured default branch name first. If it does not
match the reported commit hash, let's fall back to master
as before.
Signed-off-by: Johannes Schindelin johannes.schindelin@gmx.de
The default name of the initial branch in new repositories can now be
configured. The testsvn
remote helper translates the remote Subversion
repository's branch name trunk
to the hard-coded name master
.
Clearly, the intention was to make the name align with Git's defaults.
So while we are not talking about a newly-created repository in the
testsvn
context, it is a newly-created Git repository, si it still
makes sense to use the overridden default name for the initial branch
whenever users configured it.
Signed-off-by: Johannes Schindelin johannes.schindelin@gmx.de
[](/apps/gitgitgadget)
[](/apps/gitgitgadget)
[](/apps/gitgitgadget)
dscho deleted the default-branch-name-option branch