@@ -1190,7 +1190,7 @@ struct pattern_list *add_pattern_list(struct dir_struct *dir,
1190
1190
struct pattern_list * pl ;
1191
1191
struct exclude_list_group * group ;
1192
1192
1193
- group = & dir -> exclude_list_group [group_type ];
1193
+ group = & dir -> internal . exclude_list_group [group_type ];
1194
1194
ALLOC_GROW (group -> pl , group -> nr + 1 , group -> alloc );
1195
1195
pl = & group -> pl [group -> nr ++ ];
1196
1196
memset (pl , 0 , sizeof (* pl ));
@@ -1211,15 +1211,15 @@ static void add_patterns_from_file_1(struct dir_struct *dir, const char *fname,
1211
1211
* differently when dir->untracked is non-NULL.
1212
1212
*/
1213
1213
if (!dir -> untracked )
1214
- dir -> unmanaged_exclude_files ++ ;
1214
+ dir -> internal . unmanaged_exclude_files ++ ;
1215
1215
pl = add_pattern_list (dir , EXC_FILE , fname );
1216
1216
if (add_patterns (fname , "" , 0 , pl , NULL , 0 , oid_stat ) < 0 )
1217
1217
die (_ ("cannot use %s as an exclude file" ), fname );
1218
1218
}
1219
1219
1220
1220
void add_patterns_from_file (struct dir_struct * dir , const char * fname )
1221
1221
{
1222
- dir -> unmanaged_exclude_files ++ ; /* see validate_untracked_cache() */
1222
+ dir -> internal . unmanaged_exclude_files ++ ; /* see validate_untracked_cache() */
1223
1223
add_patterns_from_file_1 (dir , fname , NULL );
1224
1224
}
1225
1225
@@ -1519,7 +1519,7 @@ static struct path_pattern *last_matching_pattern_from_lists(
1519
1519
struct exclude_list_group * group ;
1520
1520
struct path_pattern * pattern ;
1521
1521
for (i = EXC_CMDL ; i <= EXC_FILE ; i ++ ) {
1522
- group = & dir -> exclude_list_group [i ];
1522
+ group = & dir -> internal . exclude_list_group [i ];
1523
1523
for (j = group -> nr - 1 ; j >= 0 ; j -- ) {
1524
1524
pattern = last_matching_pattern_from_list (
1525
1525
pathname , pathlen , basename , dtype_p ,
@@ -1545,41 +1545,41 @@ static void prep_exclude(struct dir_struct *dir,
1545
1545
struct untracked_cache_dir * untracked ;
1546
1546
int current ;
1547
1547
1548
- group = & dir -> exclude_list_group [EXC_DIRS ];
1548
+ group = & dir -> internal . exclude_list_group [EXC_DIRS ];
1549
1549
1550
1550
/*
1551
1551
* Pop the exclude lists from the EXCL_DIRS exclude_list_group
1552
1552
* which originate from directories not in the prefix of the
1553
1553
* path being checked.
1554
1554
*/
1555
- while ((stk = dir -> exclude_stack ) != NULL ) {
1555
+ while ((stk = dir -> internal . exclude_stack ) != NULL ) {
1556
1556
if (stk -> baselen <= baselen &&
1557
- !strncmp (dir -> basebuf .buf , base , stk -> baselen ))
1557
+ !strncmp (dir -> internal . basebuf .buf , base , stk -> baselen ))
1558
1558
break ;
1559
- pl = & group -> pl [dir -> exclude_stack -> exclude_ix ];
1560
- dir -> exclude_stack = stk -> prev ;
1561
- dir -> pattern = NULL ;
1559
+ pl = & group -> pl [dir -> internal . exclude_stack -> exclude_ix ];
1560
+ dir -> internal . exclude_stack = stk -> prev ;
1561
+ dir -> internal . pattern = NULL ;
1562
1562
free ((char * )pl -> src ); /* see strbuf_detach() below */
1563
1563
clear_pattern_list (pl );
1564
1564
free (stk );
1565
1565
group -> nr -- ;
1566
1566
}
1567
1567
1568
1568
/* Skip traversing into sub directories if the parent is excluded */
1569
- if (dir -> pattern )
1569
+ if (dir -> internal . pattern )
1570
1570
return ;
1571
1571
1572
1572
/*
1573
1573
* Lazy initialization. All call sites currently just
1574
1574
* memset(dir, 0, sizeof(*dir)) before use. Changing all of
1575
1575
* them seems lots of work for little benefit.
1576
1576
*/
1577
- if (!dir -> basebuf .buf )
1578
- strbuf_init (& dir -> basebuf , PATH_MAX );
1577
+ if (!dir -> internal . basebuf .buf )
1578
+ strbuf_init (& dir -> internal . basebuf , PATH_MAX );
1579
1579
1580
1580
/* Read from the parent directories and push them down. */
1581
1581
current = stk ? stk -> baselen : -1 ;
1582
- strbuf_setlen (& dir -> basebuf , current < 0 ? 0 : current );
1582
+ strbuf_setlen (& dir -> internal . basebuf , current < 0 ? 0 : current );
1583
1583
if (dir -> untracked )
1584
1584
untracked = stk ? stk -> ucd : dir -> untracked -> root ;
1585
1585
else
@@ -1599,32 +1599,33 @@ static void prep_exclude(struct dir_struct *dir,
1599
1599
die ("oops in prep_exclude" );
1600
1600
cp ++ ;
1601
1601
untracked =
1602
- lookup_untracked (dir -> untracked , untracked ,
1602
+ lookup_untracked (dir -> untracked ,
1603
+ untracked ,
1603
1604
base + current ,
1604
1605
cp - base - current );
1605
1606
}
1606
- stk -> prev = dir -> exclude_stack ;
1607
+ stk -> prev = dir -> internal . exclude_stack ;
1607
1608
stk -> baselen = cp - base ;
1608
1609
stk -> exclude_ix = group -> nr ;
1609
1610
stk -> ucd = untracked ;
1610
1611
pl = add_pattern_list (dir , EXC_DIRS , NULL );
1611
- strbuf_add (& dir -> basebuf , base + current , stk -> baselen - current );
1612
- assert (stk -> baselen == dir -> basebuf .len );
1612
+ strbuf_add (& dir -> internal . basebuf , base + current , stk -> baselen - current );
1613
+ assert (stk -> baselen == dir -> internal . basebuf .len );
1613
1614
1614
1615
/* Abort if the directory is excluded */
1615
1616
if (stk -> baselen ) {
1616
1617
int dt = DT_DIR ;
1617
- dir -> basebuf .buf [stk -> baselen - 1 ] = 0 ;
1618
- dir -> pattern = last_matching_pattern_from_lists (dir ,
1618
+ dir -> internal . basebuf .buf [stk -> baselen - 1 ] = 0 ;
1619
+ dir -> internal . pattern = last_matching_pattern_from_lists (dir ,
1619
1620
istate ,
1620
- dir -> basebuf .buf , stk -> baselen - 1 ,
1621
- dir -> basebuf .buf + current , & dt );
1622
- dir -> basebuf .buf [stk -> baselen - 1 ] = '/' ;
1623
- if (dir -> pattern &&
1624
- dir -> pattern -> flags & PATTERN_FLAG_NEGATIVE )
1625
- dir -> pattern = NULL ;
1626
- if (dir -> pattern ) {
1627
- dir -> exclude_stack = stk ;
1621
+ dir -> internal . basebuf .buf , stk -> baselen - 1 ,
1622
+ dir -> internal . basebuf .buf + current , & dt );
1623
+ dir -> internal . basebuf .buf [stk -> baselen - 1 ] = '/' ;
1624
+ if (dir -> internal . pattern &&
1625
+ dir -> internal . pattern -> flags & PATTERN_FLAG_NEGATIVE )
1626
+ dir -> internal . pattern = NULL ;
1627
+ if (dir -> internal . pattern ) {
1628
+ dir -> internal . exclude_stack = stk ;
1628
1629
return ;
1629
1630
}
1630
1631
}
@@ -1647,15 +1648,15 @@ static void prep_exclude(struct dir_struct *dir,
1647
1648
*/
1648
1649
!is_null_oid (& untracked -> exclude_oid ))) {
1649
1650
/*
1650
- * dir->basebuf gets reused by the traversal, but we
1651
- * need fname to remain unchanged to ensure the src
1652
- * member of each struct path_pattern correctly
1651
+ * dir->internal. basebuf gets reused by the traversal,
1652
+ * but we need fname to remain unchanged to ensure the
1653
+ * src member of each struct path_pattern correctly
1653
1654
* back-references its source file. Other invocations
1654
1655
* of add_pattern_list provide stable strings, so we
1655
1656
* strbuf_detach() and free() here in the caller.
1656
1657
*/
1657
1658
struct strbuf sb = STRBUF_INIT ;
1658
- strbuf_addbuf (& sb , & dir -> basebuf );
1659
+ strbuf_addbuf (& sb , & dir -> internal . basebuf );
1659
1660
strbuf_addstr (& sb , dir -> exclude_per_dir );
1660
1661
pl -> src = strbuf_detach (& sb , NULL );
1661
1662
add_patterns (pl -> src , pl -> src , stk -> baselen , pl , istate ,
@@ -1681,10 +1682,10 @@ static void prep_exclude(struct dir_struct *dir,
1681
1682
invalidate_gitignore (dir -> untracked , untracked );
1682
1683
oidcpy (& untracked -> exclude_oid , & oid_stat .oid );
1683
1684
}
1684
- dir -> exclude_stack = stk ;
1685
+ dir -> internal . exclude_stack = stk ;
1685
1686
current = stk -> baselen ;
1686
1687
}
1687
- strbuf_setlen (& dir -> basebuf , baselen );
1688
+ strbuf_setlen (& dir -> internal . basebuf , baselen );
1688
1689
}
1689
1690
1690
1691
/*
@@ -1704,8 +1705,8 @@ struct path_pattern *last_matching_pattern(struct dir_struct *dir,
1704
1705
1705
1706
prep_exclude (dir , istate , pathname , basename - pathname );
1706
1707
1707
- if (dir -> pattern )
1708
- return dir -> pattern ;
1708
+ if (dir -> internal . pattern )
1709
+ return dir -> internal . pattern ;
1709
1710
1710
1711
return last_matching_pattern_from_lists (dir , istate , pathname , pathlen ,
1711
1712
basename , dtype_p );
@@ -1742,7 +1743,7 @@ static struct dir_entry *dir_add_name(struct dir_struct *dir,
1742
1743
if (index_file_exists (istate , pathname , len , ignore_case ))
1743
1744
return NULL ;
1744
1745
1745
- ALLOC_GROW (dir -> entries , dir -> nr + 1 , dir -> alloc );
1746
+ ALLOC_GROW (dir -> entries , dir -> nr + 1 , dir -> internal . alloc );
1746
1747
return dir -> entries [dir -> nr ++ ] = dir_entry_new (pathname , len );
1747
1748
}
1748
1749
@@ -1753,7 +1754,7 @@ struct dir_entry *dir_add_ignored(struct dir_struct *dir,
1753
1754
if (!index_name_is_other (istate , pathname , len ))
1754
1755
return NULL ;
1755
1756
1756
- ALLOC_GROW (dir -> ignored , dir -> ignored_nr + 1 , dir -> ignored_alloc );
1757
+ ALLOC_GROW (dir -> ignored , dir -> ignored_nr + 1 , dir -> internal . ignored_alloc );
1757
1758
return dir -> ignored [dir -> ignored_nr ++ ] = dir_entry_new (pathname , len );
1758
1759
}
1759
1760
@@ -2569,7 +2570,7 @@ static enum path_treatment read_directory_recursive(struct dir_struct *dir,
2569
2570
2570
2571
if (open_cached_dir (& cdir , dir , untracked , istate , & path , check_only ))
2571
2572
goto out ;
2572
- dir -> visited_directories ++ ;
2573
+ dir -> internal . visited_directories ++ ;
2573
2574
2574
2575
if (untracked )
2575
2576
untracked -> check_only = !!check_only ;
@@ -2578,15 +2579,16 @@ static enum path_treatment read_directory_recursive(struct dir_struct *dir,
2578
2579
/* check how the file or directory should be treated */
2579
2580
state = treat_path (dir , untracked , & cdir , istate , & path ,
2580
2581
baselen , pathspec );
2581
- dir -> visited_paths ++ ;
2582
+ dir -> internal . visited_paths ++ ;
2582
2583
2583
2584
if (state > dir_state )
2584
2585
dir_state = state ;
2585
2586
2586
2587
/* recurse into subdir if instructed by treat_path */
2587
2588
if (state == path_recurse ) {
2588
2589
struct untracked_cache_dir * ud ;
2589
- ud = lookup_untracked (dir -> untracked , untracked ,
2590
+ ud = lookup_untracked (dir -> untracked ,
2591
+ untracked ,
2590
2592
path .buf + baselen ,
2591
2593
path .len - baselen );
2592
2594
subdir_state =
@@ -2846,7 +2848,7 @@ static struct untracked_cache_dir *validate_untracked_cache(struct dir_struct *d
2846
2848
* condition also catches running setup_standard_excludes()
2847
2849
* before setting dir->untracked!
2848
2850
*/
2849
- if (dir -> unmanaged_exclude_files )
2851
+ if (dir -> internal . unmanaged_exclude_files )
2850
2852
return NULL ;
2851
2853
2852
2854
/*
@@ -2875,7 +2877,7 @@ static struct untracked_cache_dir *validate_untracked_cache(struct dir_struct *d
2875
2877
* EXC_CMDL is not considered in the cache. If people set it,
2876
2878
* skip the cache.
2877
2879
*/
2878
- if (dir -> exclude_list_group [EXC_CMDL ].nr )
2880
+ if (dir -> internal . exclude_list_group [EXC_CMDL ].nr )
2879
2881
return NULL ;
2880
2882
2881
2883
if (!ident_in_untracked (dir -> untracked )) {
@@ -2935,15 +2937,15 @@ static struct untracked_cache_dir *validate_untracked_cache(struct dir_struct *d
2935
2937
2936
2938
/* Validate $GIT_DIR/info/exclude and core.excludesfile */
2937
2939
root = dir -> untracked -> root ;
2938
- if (!oideq (& dir -> ss_info_exclude .oid ,
2940
+ if (!oideq (& dir -> internal . ss_info_exclude .oid ,
2939
2941
& dir -> untracked -> ss_info_exclude .oid )) {
2940
2942
invalidate_gitignore (dir -> untracked , root );
2941
- dir -> untracked -> ss_info_exclude = dir -> ss_info_exclude ;
2943
+ dir -> untracked -> ss_info_exclude = dir -> internal . ss_info_exclude ;
2942
2944
}
2943
- if (!oideq (& dir -> ss_excludes_file .oid ,
2945
+ if (!oideq (& dir -> internal . ss_excludes_file .oid ,
2944
2946
& dir -> untracked -> ss_excludes_file .oid )) {
2945
2947
invalidate_gitignore (dir -> untracked , root );
2946
- dir -> untracked -> ss_excludes_file = dir -> ss_excludes_file ;
2948
+ dir -> untracked -> ss_excludes_file = dir -> internal . ss_excludes_file ;
2947
2949
}
2948
2950
2949
2951
/* Make sure this directory is not dropped out at saving phase */
@@ -2969,9 +2971,9 @@ static void emit_traversal_statistics(struct dir_struct *dir,
2969
2971
}
2970
2972
2971
2973
trace2_data_intmax ("read_directory" , repo ,
2972
- "directories-visited" , dir -> visited_directories );
2974
+ "directories-visited" , dir -> internal . visited_directories );
2973
2975
trace2_data_intmax ("read_directory" , repo ,
2974
- "paths-visited" , dir -> visited_paths );
2976
+ "paths-visited" , dir -> internal . visited_paths );
2975
2977
2976
2978
if (!dir -> untracked )
2977
2979
return ;
@@ -2993,8 +2995,8 @@ int read_directory(struct dir_struct *dir, struct index_state *istate,
2993
2995
struct untracked_cache_dir * untracked ;
2994
2996
2995
2997
trace2_region_enter ("dir" , "read_directory" , istate -> repo );
2996
- dir -> visited_paths = 0 ;
2997
- dir -> visited_directories = 0 ;
2998
+ dir -> internal . visited_paths = 0 ;
2999
+ dir -> internal . visited_directories = 0 ;
2998
3000
2999
3001
if (has_symlink_leading_path (path , len )) {
3000
3002
trace2_region_leave ("dir" , "read_directory" , istate -> repo );
@@ -3342,14 +3344,14 @@ void setup_standard_excludes(struct dir_struct *dir)
3342
3344
excludes_file = xdg_config_home ("ignore" );
3343
3345
if (excludes_file && !access_or_warn (excludes_file , R_OK , 0 ))
3344
3346
add_patterns_from_file_1 (dir , excludes_file ,
3345
- dir -> untracked ? & dir -> ss_excludes_file : NULL );
3347
+ dir -> untracked ? & dir -> internal . ss_excludes_file : NULL );
3346
3348
3347
3349
/* per repository user preference */
3348
3350
if (startup_info -> have_repository ) {
3349
3351
const char * path = git_path_info_exclude ();
3350
3352
if (!access_or_warn (path , R_OK , 0 ))
3351
3353
add_patterns_from_file_1 (dir , path ,
3352
- dir -> untracked ? & dir -> ss_info_exclude : NULL );
3354
+ dir -> untracked ? & dir -> internal . ss_info_exclude : NULL );
3353
3355
}
3354
3356
}
3355
3357
@@ -3405,7 +3407,7 @@ void dir_clear(struct dir_struct *dir)
3405
3407
struct dir_struct new = DIR_INIT ;
3406
3408
3407
3409
for (i = EXC_CMDL ; i <= EXC_FILE ; i ++ ) {
3408
- group = & dir -> exclude_list_group [i ];
3410
+ group = & dir -> internal . exclude_list_group [i ];
3409
3411
for (j = 0 ; j < group -> nr ; j ++ ) {
3410
3412
pl = & group -> pl [j ];
3411
3413
if (i == EXC_DIRS )
@@ -3422,13 +3424,13 @@ void dir_clear(struct dir_struct *dir)
3422
3424
free (dir -> ignored );
3423
3425
free (dir -> entries );
3424
3426
3425
- stk = dir -> exclude_stack ;
3427
+ stk = dir -> internal . exclude_stack ;
3426
3428
while (stk ) {
3427
3429
struct exclude_stack * prev = stk -> prev ;
3428
3430
free (stk );
3429
3431
stk = prev ;
3430
3432
}
3431
- strbuf_release (& dir -> basebuf );
3433
+ strbuf_release (& dir -> internal . basebuf );
3432
3434
3433
3435
memcpy (dir , & new , sizeof (* dir ));
3434
3436
}
0 commit comments