]> git.ipfire.org Git - thirdparty/git.git/commit
clone: introduce struct clone_opts in builtin/clone.c
authorToon Claes <toon@iotcl.com>
Thu, 6 Feb 2025 06:33:33 +0000 (07:33 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 6 Feb 2025 20:23:54 +0000 (12:23 -0800)
commit7a52a8c7d855d3ed779059af160248934ac2c6b0
treeac459e99c5846ff6e2d77769d9e408de4c9e7190
parent2ca67c6f1433586e61487295bb04cc424992db12
clone: introduce struct clone_opts in builtin/clone.c

There is a lot of state stored in global variables in builtin/clone.c.
In the long run we'd like to remove many of those.

Introduce `struct clone_opts` in this file. This struct will be used to
contain all details needed to perform the clone. The struct object can
be thrown around to all the functions that need these details.

The first field we're adding is `wants_head`. In some scenarios
(specifically when both `--single-branch` and `--branch` are given) we
are not interested in `HEAD` on the remote. The field `wants_head` in
`struct clone_opts` will hold this information. We could have put
`option_branch` and `option_single_branch` into that struct instead, but
in a following commit we'll be using `wants_head` as well.

Signed-off-by: Toon Claes <toon@iotcl.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/clone.c
remote.c
remote.h