]> git.ipfire.org Git - thirdparty/git.git/commit - remote.c
builtin/clone: skip reading HEAD when retrieving remote
authorPatrick Steinhardt <ps@pks.im>
Tue, 12 Dec 2023 07:01:03 +0000 (08:01 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 12 Dec 2023 19:16:54 +0000 (11:16 -0800)
commit3c8f60c6416bdfcc690ff5d56d80350a89ed92b5
tree1236ebedb4e2e449a7924b0f153f21ebe41d8077
parent360822a3471f779c761694b11f30ff738c6851e9
builtin/clone: skip reading HEAD when retrieving remote

After we have set up the remote configuration in git-clone(1) we'll call
`remote_get()` to read the remote from the on-disk configuration. But
next to reading the on-disk configuration, `remote_get()` will also
cause us to try and read the repository's HEAD reference so that we can
figure out the current branch. Besides being pointless in git-clone(1)
because we're operating in an empty repository anyway, this will also
break once we move creation of the reference database to a later point
in time.

Refactor the code to introduce a new `remote_get_early()` function that
will skip reading the HEAD reference to address this issue.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/clone.c
remote.c
remote.h