fetch: set remote/HEAD if it does not exist
When cloning a repository remote/HEAD is created, but when the user creates a repository with git init, and later adds a remote, remote/HEAD is only created if the user explicitly runs a variant of "remote set-head". Attempt to set remote/HEAD during fetch, if the user does not have it already set. Silently ignore any errors. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
9963746c84
commit
3f763ddf28
@ -31,7 +31,7 @@ test_expect_success 'set up repository to clone' '
|
||||
)
|
||||
'
|
||||
|
||||
cleanup_clone () {
|
||||
cleanup_clone() {
|
||||
rm -rf "$1"
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ test_expect_success '--single-branch clones HEAD only' '
|
||||
(
|
||||
cd $enlistment/src &&
|
||||
git for-each-ref refs/remotes/origin >out &&
|
||||
test_line_count = 1 out &&
|
||||
test_line_count = 2 out &&
|
||||
grep "refs/remotes/origin/base" out
|
||||
) &&
|
||||
|
||||
@ -141,7 +141,7 @@ test_expect_success '--no-single-branch clones all branches' '
|
||||
(
|
||||
cd $enlistment/src &&
|
||||
git for-each-ref refs/remotes/origin >out &&
|
||||
test_line_count = 2 out &&
|
||||
test_line_count = 3 out &&
|
||||
grep "refs/remotes/origin/base" out &&
|
||||
grep "refs/remotes/origin/parallel" out
|
||||
) &&
|
||||
|
Reference in New Issue
Block a user