diff options
author | Elijah Newren <newren@gmail.com> | 2022-02-19 19:44:41 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-02-20 11:01:15 +0300 |
commit | f748012e01109d04d3e956e26557a7fb4f92ce47 (patch) | |
tree | 644823ced03b34a8ca9c747a3278a33a18285d5d /builtin/sparse-checkout.c | |
parent | b80121027d1247a0754b3cc46897fee75c050b44 (diff) |
sparse-checkout: correct reapply's handling of options
Commit 4e256731d6 ("sparse-checkout: enable reapply to take
--[no-]{cone,sparse-index}", 2021-12-14) made it so that reapply could
take additional options but added no tests. Tests would have shown that
the feature doesn't work because the initial values are set AFTER
parsing the command line options instead of before. Add a test and set
the initial value at the appropriate time.
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.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c index a311483a7d..fcd574f5fc 100644 --- a/builtin/sparse-checkout.c +++ b/builtin/sparse-checkout.c @@ -789,15 +789,15 @@ static int sparse_checkout_reapply(int argc, const char **argv) if (!core_apply_sparse_checkout) die(_("must be in a sparse-checkout to reapply sparsity patterns")); + reapply_opts.cone_mode = -1; + reapply_opts.sparse_index = -1; + argc = parse_options(argc, argv, NULL, builtin_sparse_checkout_reapply_options, builtin_sparse_checkout_reapply_usage, 0); repo_read_index(the_repository); - reapply_opts.cone_mode = -1; - reapply_opts.sparse_index = -1; - if (update_modes(&reapply_opts.cone_mode, &reapply_opts.sparse_index)) return 1; |