@@ -62,7 +62,7 @@ static int sparse_checkout_list(int argc, const char **argv, const char *prefix,
62
62
int res ;
63
63
64
64
setup_work_tree ();
65
- if (!core_apply_sparse_checkout )
65
+ if (!the_repository -> settings . sparse_checkout )
66
66
die (_ ("this worktree is not sparse" ));
67
67
68
68
argc = parse_options (argc , argv , prefix ,
@@ -71,7 +71,7 @@ static int sparse_checkout_list(int argc, const char **argv, const char *prefix,
71
71
72
72
memset (& pl , 0 , sizeof (pl ));
73
73
74
- pl .use_cone_patterns = core_sparse_checkout_cone ;
74
+ pl .use_cone_patterns = the_repository -> settings . sparse_checkout_cone ;
75
75
76
76
sparse_filename = get_sparse_checkout_filename ();
77
77
res = add_patterns_from_file_to_list (sparse_filename , "" , 0 , & pl , NULL , 0 );
@@ -352,7 +352,7 @@ static int write_patterns_and_update(struct pattern_list *pl)
352
352
if (!fp )
353
353
die_errno (_ ("unable to fdopen %s" ), get_lock_file_path (& lk ));
354
354
355
- if (core_sparse_checkout_cone )
355
+ if (the_repository -> settings . sparse_checkout_cone )
356
356
write_cone_to_file (fp , pl );
357
357
else
358
358
write_patterns_to_file (fp , pl );
@@ -397,16 +397,16 @@ static int set_config(enum sparse_checkout_mode mode)
397
397
398
398
static enum sparse_checkout_mode update_cone_mode (int * cone_mode ) {
399
399
/* If not specified, use previous definition of cone mode */
400
- if (* cone_mode == -1 && core_apply_sparse_checkout )
401
- * cone_mode = core_sparse_checkout_cone ;
400
+ if (* cone_mode == -1 && the_repository -> settings . sparse_checkout )
401
+ * cone_mode = the_repository -> settings . sparse_checkout_cone ;
402
402
403
403
/* Set cone/non-cone mode appropriately */
404
- core_apply_sparse_checkout = 1 ;
404
+ the_repository -> settings . sparse_checkout = 1 ;
405
405
if (* cone_mode == 1 || * cone_mode == -1 ) {
406
- core_sparse_checkout_cone = 1 ;
406
+ the_repository -> settings . sparse_checkout_cone = 1 ;
407
407
return MODE_CONE_PATTERNS ;
408
408
}
409
- core_sparse_checkout_cone = 0 ;
409
+ the_repository -> settings . sparse_checkout_cone = 0 ;
410
410
return MODE_ALL_PATTERNS ;
411
411
}
412
412
@@ -415,7 +415,7 @@ static int update_modes(int *cone_mode, int *sparse_index)
415
415
int mode , record_mode ;
416
416
417
417
/* Determine if we need to record the mode; ensure sparse checkout on */
418
- record_mode = (* cone_mode != -1 ) || !core_apply_sparse_checkout ;
418
+ record_mode = (* cone_mode != -1 ) || !the_repository -> settings . sparse_checkout ;
419
419
420
420
mode = update_cone_mode (cone_mode );
421
421
if (record_mode && set_config (mode ))
@@ -572,7 +572,7 @@ static void add_patterns_from_input(struct pattern_list *pl,
572
572
FILE * file )
573
573
{
574
574
int i ;
575
- if (core_sparse_checkout_cone ) {
575
+ if (the_repository -> settings . sparse_checkout_cone ) {
576
576
struct strbuf line = STRBUF_INIT ;
577
577
578
578
hashmap_init (& pl -> recursive_hashmap , pl_hashmap_cmp , NULL , 0 );
@@ -637,7 +637,7 @@ static void add_patterns_cone_mode(int argc, const char **argv,
637
637
use_stdin ? stdin : NULL );
638
638
639
639
memset (& existing , 0 , sizeof (existing ));
640
- existing .use_cone_patterns = core_sparse_checkout_cone ;
640
+ existing .use_cone_patterns = the_repository -> settings . sparse_checkout_cone ;
641
641
642
642
if (add_patterns_from_file_to_list (sparse_filename , "" , 0 ,
643
643
& existing , NULL , 0 ))
@@ -683,7 +683,7 @@ static int modify_pattern_list(struct strvec *args, int use_stdin,
683
683
684
684
switch (m ) {
685
685
case ADD :
686
- if (core_sparse_checkout_cone )
686
+ if (the_repository -> settings . sparse_checkout_cone )
687
687
add_patterns_cone_mode (args -> nr , args -> v , pl , use_stdin );
688
688
else
689
689
add_patterns_literal (args -> nr , args -> v , pl , use_stdin );
@@ -695,9 +695,9 @@ static int modify_pattern_list(struct strvec *args, int use_stdin,
695
695
break ;
696
696
}
697
697
698
- if (!core_apply_sparse_checkout ) {
698
+ if (!the_repository -> settings . sparse_checkout ) {
699
699
set_config (MODE_ALL_PATTERNS );
700
- core_apply_sparse_checkout = 1 ;
700
+ the_repository -> settings . sparse_checkout = 1 ;
701
701
changed_config = 1 ;
702
702
}
703
703
@@ -719,7 +719,7 @@ static void sanitize_paths(struct strvec *args,
719
719
if (!args -> nr )
720
720
return ;
721
721
722
- if (prefix && * prefix && core_sparse_checkout_cone ) {
722
+ if (prefix && * prefix && the_repository -> settings . sparse_checkout_cone ) {
723
723
/*
724
724
* The args are not pathspecs, so unfortunately we
725
725
* cannot imitate how cmd_add() uses parse_pathspec().
@@ -736,10 +736,10 @@ static void sanitize_paths(struct strvec *args,
736
736
if (skip_checks )
737
737
return ;
738
738
739
- if (prefix && * prefix && !core_sparse_checkout_cone )
739
+ if (prefix && * prefix && !the_repository -> settings . sparse_checkout_cone )
740
740
die (_ ("please run from the toplevel directory in non-cone mode" ));
741
741
742
- if (core_sparse_checkout_cone ) {
742
+ if (the_repository -> settings . sparse_checkout_cone ) {
743
743
for (i = 0 ; i < args -> nr ; i ++ ) {
744
744
if (args -> v [i ][0 ] == '/' )
745
745
die (_ ("specify directories rather than patterns (no leading slash)" ));
@@ -761,7 +761,7 @@ static void sanitize_paths(struct strvec *args,
761
761
if (S_ISSPARSEDIR (ce -> ce_mode ))
762
762
continue ;
763
763
764
- if (core_sparse_checkout_cone )
764
+ if (the_repository -> settings . sparse_checkout_cone )
765
765
die (_ ("'%s' is not a directory; to treat it as a directory anyway, rerun with --skip-checks" ), args -> v [i ]);
766
766
else
767
767
warning (_ ("pass a leading slash before paths such as '%s' if you want a single file (see NON-CONE PROBLEMS in the git-sparse-checkout manual)." ), args -> v [i ]);
@@ -793,7 +793,7 @@ static int sparse_checkout_add(int argc, const char **argv, const char *prefix,
793
793
int ret ;
794
794
795
795
setup_work_tree ();
796
- if (!core_apply_sparse_checkout )
796
+ if (!the_repository -> settings . sparse_checkout )
797
797
die (_ ("no sparse-checkout to add to" ));
798
798
799
799
repo_read_index (the_repository );
@@ -864,7 +864,7 @@ static int sparse_checkout_set(int argc, const char **argv, const char *prefix,
864
864
* non-cone mode, if nothing is specified, manually select just the
865
865
* top-level directory (much as 'init' would do).
866
866
*/
867
- if (!core_sparse_checkout_cone && !set_opts .use_stdin && argc == 0 ) {
867
+ if (!the_repository -> settings . sparse_checkout_cone && !set_opts .use_stdin && argc == 0 ) {
868
868
for (int i = 0 ; i < default_patterns_nr ; i ++ )
869
869
strvec_push (& patterns , default_patterns [i ]);
870
870
} else {
@@ -902,7 +902,7 @@ static int sparse_checkout_reapply(int argc, const char **argv,
902
902
};
903
903
904
904
setup_work_tree ();
905
- if (!core_apply_sparse_checkout )
905
+ if (!the_repository -> settings . sparse_checkout )
906
906
die (_ ("must be in a sparse-checkout to reapply sparsity patterns" ));
907
907
908
908
reapply_opts .cone_mode = -1 ;
@@ -935,7 +935,7 @@ static int sparse_checkout_disable(int argc, const char **argv,
935
935
struct pattern_list pl ;
936
936
937
937
/*
938
- * We do not exit early if !core_apply_sparse_checkout ; due to the
938
+ * We do not exit early if !sparse_checkout ; due to the
939
939
* ability for users to manually muck things up between
940
940
* direct editing of .git/info/sparse-checkout
941
941
* running read-tree -m u HEAD or update-index --skip-worktree
@@ -961,11 +961,10 @@ static int sparse_checkout_disable(int argc, const char **argv,
961
961
hashmap_init (& pl .recursive_hashmap , pl_hashmap_cmp , NULL , 0 );
962
962
hashmap_init (& pl .parent_hashmap , pl_hashmap_cmp , NULL , 0 );
963
963
pl .use_cone_patterns = 0 ;
964
- core_apply_sparse_checkout = 1 ;
964
+ the_repository -> settings . sparse_checkout = 1 ;
965
965
966
966
add_pattern ("/*" , empty_base , 0 , & pl , 0 );
967
967
968
- prepare_repo_settings (the_repository );
969
968
the_repository -> settings .sparse_index = 0 ;
970
969
971
970
if (update_working_directory (& pl ))
@@ -1042,7 +1041,7 @@ static int sparse_checkout_check_rules(int argc, const char **argv, const char *
1042
1041
check_rules_opts .cone_mode = 1 ;
1043
1042
1044
1043
update_cone_mode (& check_rules_opts .cone_mode );
1045
- pl .use_cone_patterns = core_sparse_checkout_cone ;
1044
+ pl .use_cone_patterns = the_repository -> settings . sparse_checkout_cone ;
1046
1045
if (check_rules_opts .rules_file ) {
1047
1046
fp = xfopen (check_rules_opts .rules_file , "r" );
1048
1047
add_patterns_from_input (& pl , argc , argv , fp );
0 commit comments