]> git.ipfire.org Git - thirdparty/git.git/commit - remote.c
remote: use the configured default branch name when appropriate
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Wed, 24 Jun 2020 14:46:35 +0000 (14:46 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 24 Jun 2020 16:14:21 +0000 (09:14 -0700)
commita471214bd610bb415a37d5b2c3506b83549acd57
treeda4811bd343763fb77d4166a9802e6fdb39bf4ba
parent0cc1b475bbcc530c5429c741fbcfdc2730d27223
remote: use the configured default branch name when appropriate

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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
remote.c
t/t5606-clone-options.sh