@@ -61,9 +61,10 @@ static int sparse_checkout_list(int argc, const char **argv, const char *prefix,
6161 struct pattern_list pl ;
6262 char * sparse_filename ;
6363 int res ;
64+ struct repo_config_values * cfg = repo_config_values (the_repository );
6465
6566 setup_work_tree ();
66- if (!core_apply_sparse_checkout )
67+ if (!cfg -> apply_sparse_checkout )
6768 die (_ ("this worktree is not sparse" ));
6869
6970 argc = parse_options (argc , argv , prefix ,
@@ -397,12 +398,14 @@ static int set_config(struct repository *repo,
397398}
398399
399400static enum sparse_checkout_mode update_cone_mode (int * cone_mode ) {
401+ struct repo_config_values * cfg = repo_config_values (the_repository );
402+
400403 /* If not specified, use previous definition of cone mode */
401- if (* cone_mode == -1 && core_apply_sparse_checkout )
404+ if (* cone_mode == -1 && cfg -> apply_sparse_checkout )
402405 * cone_mode = core_sparse_checkout_cone ;
403406
404407 /* Set cone/non-cone mode appropriately */
405- core_apply_sparse_checkout = 1 ;
408+ cfg -> apply_sparse_checkout = 1 ;
406409 if (* cone_mode == 1 || * cone_mode == -1 ) {
407410 core_sparse_checkout_cone = 1 ;
408411 return MODE_CONE_PATTERNS ;
@@ -414,9 +417,10 @@ static enum sparse_checkout_mode update_cone_mode(int *cone_mode) {
414417static int update_modes (struct repository * repo , int * cone_mode , int * sparse_index )
415418{
416419 int mode , record_mode ;
420+ struct repo_config_values * cfg = repo_config_values (the_repository );
417421
418422 /* Determine if we need to record the mode; ensure sparse checkout on */
419- record_mode = (* cone_mode != -1 ) || !core_apply_sparse_checkout ;
423+ record_mode = (* cone_mode != -1 ) || !cfg -> apply_sparse_checkout ;
420424
421425 mode = update_cone_mode (cone_mode );
422426 if (record_mode && set_config (repo , mode ))
@@ -682,6 +686,7 @@ static int modify_pattern_list(struct repository *repo,
682686 int result ;
683687 int changed_config = 0 ;
684688 struct pattern_list * pl = xcalloc (1 , sizeof (* pl ));
689+ struct repo_config_values * cfg = repo_config_values (the_repository );
685690
686691 switch (m ) {
687692 case ADD :
@@ -697,9 +702,9 @@ static int modify_pattern_list(struct repository *repo,
697702 break ;
698703 }
699704
700- if (!core_apply_sparse_checkout ) {
705+ if (!cfg -> apply_sparse_checkout ) {
701706 set_config (repo , MODE_ALL_PATTERNS );
702- core_apply_sparse_checkout = 1 ;
707+ cfg -> apply_sparse_checkout = 1 ;
703708 changed_config = 1 ;
704709 }
705710
@@ -794,9 +799,10 @@ static int sparse_checkout_add(int argc, const char **argv, const char *prefix,
794799 };
795800 struct strvec patterns = STRVEC_INIT ;
796801 int ret ;
802+ struct repo_config_values * cfg = repo_config_values (the_repository );
797803
798804 setup_work_tree ();
799- if (!core_apply_sparse_checkout )
805+ if (!cfg -> apply_sparse_checkout )
800806 die (_ ("no sparse-checkout to add to" ));
801807
802808 repo_read_index (repo );
@@ -903,9 +909,10 @@ static int sparse_checkout_reapply(int argc, const char **argv,
903909 N_ ("toggle the use of a sparse index" )),
904910 OPT_END (),
905911 };
912+ struct repo_config_values * cfg = repo_config_values (the_repository );
906913
907914 setup_work_tree ();
908- if (!core_apply_sparse_checkout )
915+ if (!cfg -> apply_sparse_checkout )
909916 die (_ ("must be in a sparse-checkout to reapply sparsity patterns" ));
910917
911918 reapply_opts .cone_mode = -1 ;
@@ -958,6 +965,7 @@ static int sparse_checkout_clean(int argc, const char **argv,
958965 size_t worktree_len ;
959966 int force = 0 , dry_run = 0 , verbose = 0 ;
960967 int require_force = 1 ;
968+ struct repo_config_values * cfg = repo_config_values (the_repository );
961969
962970 struct option builtin_sparse_checkout_clean_options [] = {
963971 OPT__DRY_RUN (& dry_run , N_ ("dry run" )),
@@ -967,7 +975,7 @@ static int sparse_checkout_clean(int argc, const char **argv,
967975 };
968976
969977 setup_work_tree ();
970- if (!core_apply_sparse_checkout )
978+ if (!cfg -> apply_sparse_checkout )
971979 die (_ ("must be in a sparse-checkout to clean directories" ));
972980 if (!core_sparse_checkout_cone )
973981 die (_ ("must be in a cone-mode sparse-checkout to clean directories" ));
@@ -1031,9 +1039,10 @@ static int sparse_checkout_disable(int argc, const char **argv,
10311039 OPT_END (),
10321040 };
10331041 struct pattern_list pl ;
1042+ struct repo_config_values * cfg = repo_config_values (the_repository );
10341043
10351044 /*
1036- * We do not exit early if !core_apply_sparse_checkout ; due to the
1045+ * We do not exit early if !repo->config_values.apply_sparse_checkout ; due to the
10371046 * ability for users to manually muck things up between
10381047 * direct editing of .git/info/sparse-checkout
10391048 * running read-tree -m u HEAD or update-index --skip-worktree
@@ -1059,7 +1068,7 @@ static int sparse_checkout_disable(int argc, const char **argv,
10591068 hashmap_init (& pl .recursive_hashmap , pl_hashmap_cmp , NULL , 0 );
10601069 hashmap_init (& pl .parent_hashmap , pl_hashmap_cmp , NULL , 0 );
10611070 pl .use_cone_patterns = 0 ;
1062- core_apply_sparse_checkout = 1 ;
1071+ cfg -> apply_sparse_checkout = 1 ;
10631072
10641073 add_pattern ("/*" , empty_base , 0 , & pl , 0 );
10651074
0 commit comments