@@ -1932,6 +1932,40 @@ static void close_cached_dir(struct cached_dir *cdir)
1932
1932
}
1933
1933
}
1934
1934
1935
+ static void add_path_to_appropriate_result_list (struct dir_struct * dir ,
1936
+ struct untracked_cache_dir * untracked ,
1937
+ struct cached_dir * cdir ,
1938
+ struct index_state * istate ,
1939
+ struct strbuf * path ,
1940
+ int baselen ,
1941
+ const struct pathspec * pathspec ,
1942
+ enum path_treatment state )
1943
+ {
1944
+ /* add the path to the appropriate result list */
1945
+ switch (state ) {
1946
+ case path_excluded :
1947
+ if (dir -> flags & DIR_SHOW_IGNORED )
1948
+ dir_add_name (dir , istate , path -> buf , path -> len );
1949
+ else if ((dir -> flags & DIR_SHOW_IGNORED_TOO ) ||
1950
+ ((dir -> flags & DIR_COLLECT_IGNORED ) &&
1951
+ exclude_matches_pathspec (path -> buf , path -> len ,
1952
+ pathspec )))
1953
+ dir_add_ignored (dir , istate , path -> buf , path -> len );
1954
+ break ;
1955
+
1956
+ case path_untracked :
1957
+ if (dir -> flags & DIR_SHOW_IGNORED )
1958
+ break ;
1959
+ dir_add_name (dir , istate , path -> buf , path -> len );
1960
+ if (cdir -> fdir )
1961
+ add_untracked (untracked , path -> buf + baselen );
1962
+ break ;
1963
+
1964
+ default :
1965
+ break ;
1966
+ }
1967
+ }
1968
+
1935
1969
/*
1936
1970
* Read a directory tree. We currently ignore anything but
1937
1971
* directories, regular files and symlinks. That's because git
@@ -2035,29 +2069,9 @@ static enum path_treatment read_directory_recursive(struct dir_struct *dir,
2035
2069
continue ;
2036
2070
}
2037
2071
2038
- /* add the path to the appropriate result list */
2039
- switch (state ) {
2040
- case path_excluded :
2041
- if (dir -> flags & DIR_SHOW_IGNORED )
2042
- dir_add_name (dir , istate , path .buf , path .len );
2043
- else if ((dir -> flags & DIR_SHOW_IGNORED_TOO ) ||
2044
- ((dir -> flags & DIR_COLLECT_IGNORED ) &&
2045
- exclude_matches_pathspec (path .buf , path .len ,
2046
- pathspec )))
2047
- dir_add_ignored (dir , istate , path .buf , path .len );
2048
- break ;
2049
-
2050
- case path_untracked :
2051
- if (dir -> flags & DIR_SHOW_IGNORED )
2052
- break ;
2053
- dir_add_name (dir , istate , path .buf , path .len );
2054
- if (cdir .fdir )
2055
- add_untracked (untracked , path .buf + baselen );
2056
- break ;
2057
-
2058
- default :
2059
- break ;
2060
- }
2072
+ add_path_to_appropriate_result_list (dir , untracked , & cdir ,
2073
+ istate , & path , baselen ,
2074
+ pathspec , state );
2061
2075
}
2062
2076
close_cached_dir (& cdir );
2063
2077
out :
0 commit comments