Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2022-02-19 19:44:42 +0300
committerJunio C Hamano <gitster@pobox.com>2022-02-20 11:01:15 +0300
commitd526b4dbe1ab5bb7dfa9502237da81b940be876c (patch)
treea5cce69bc36336404f3571a352ee8cba5c1fc1f0 /builtin/sparse-checkout.c
parentf748012e01109d04d3e956e26557a7fb4f92ce47 (diff)
sparse-checkout: correctly set non-cone mode when expected
commit f2e3a218e8 ("sparse-checkout: enable `set` to initialize sparse-checkout mode", 2021-12-14) made the `set` command able to initialize sparse-checkout mode, but it also had to function when sparse-checkout mode was already setup and the user just wanted to change the sparsity paths. So, if the user passed --cone or --no-cone, then we should override the current setting, but if they didn't pass either, we should use whatever the current cone mode setting is. Unfortunately, there was a small error in the logic in that it would not set the in-memory cone mode value (core_sparse_checkout_one) when --no-cone was specified, but since it did set the config setting on disk, any subsequent git invocation would correctly get non-cone mode. As such, the error did not previously matter. However, a subsequent commit will add some logic that depends on core_sparse_checkout_cone being set to the correct mode, so make sure it is set consistently with the config values we will be writing to disk. Reviewed-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/sparse-checkout.c')
-rw-r--r--builtin/sparse-checkout.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c
index fcd574f5fc..fb85a1459c 100644
--- a/builtin/sparse-checkout.c
+++ b/builtin/sparse-checkout.c
@@ -403,6 +403,7 @@ static int update_modes(int *cone_mode, int *sparse_index)
core_sparse_checkout_cone = 1;
} else {
mode = MODE_ALL_PATTERNS;
+ core_sparse_checkout_cone = 0;
}
if (record_mode && set_config(mode))
return 1;