diff options
author | Patrick Steinhardt <ps@pks.im> | 2023-12-12 07:01:03 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-12-12 19:16:54 (GMT) |
commit | 3c8f60c6416bdfcc690ff5d56d80350a89ed92b5 (patch) | |
tree | 1236ebedb4e2e449a7924b0f153f21ebe41d8077 /builtin/clone.c | |
parent | 360822a3471f779c761694b11f30ff738c6851e9 (diff) | |
download | git-3c8f60c6416bdfcc690ff5d56d80350a89ed92b5.zip git-3c8f60c6416bdfcc690ff5d56d80350a89ed92b5.tar.gz git-3c8f60c6416bdfcc690ff5d56d80350a89ed92b5.tar.bz2 |
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>
Diffstat (limited to 'builtin/clone.c')
-rw-r--r-- | builtin/clone.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/clone.c b/builtin/clone.c index 9c60923..06966c5 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -1185,7 +1185,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix) if (option_required_reference.nr || option_optional_reference.nr) setup_reference(); - remote = remote_get(remote_name); + remote = remote_get_early(remote_name); refspec_appendf(&remote->fetch, "+%s*:%s*", src_ref_prefix, branch_top.buf); |