@@ -845,7 +845,7 @@ static bool pkgmap_is_reparse_point(const char *abs_path) {
845845 * it hang. On Windows we additionally skip reparse points before
846846 * descending as a best-effort early-out. */
847847static int pkgmap_walk_dir (const char * abs_dir , const char * rel_dir , cbm_pkg_entries_t * entries ,
848- int depth ) {
848+ int depth , char * * excluded_dirs , int excluded_count ) {
849849 if (depth >= PKGMAP_WALK_MAX_DEPTH ) {
850850 cbm_log_info ("pkgmap.walk" , "depth_cap" , rel_dir && rel_dir [0 ] ? rel_dir : "." );
851851 return 0 ;
@@ -874,7 +874,8 @@ static int pkgmap_walk_dir(const char *abs_dir, const char *rel_dir, cbm_pkg_ent
874874 continue ;
875875 }
876876 if (S_ISDIR (st .st_mode )) {
877- if (cbm_should_skip_dir (name , CBM_MODE_FULL )) {
877+ if (cbm_should_skip_dir (name , CBM_MODE_FULL ) ||
878+ cbm_pipeline_relpath_is_excluded (rel_path , excluded_dirs , excluded_count )) {
878879 continue ;
879880 }
880881#ifdef _WIN32
@@ -886,7 +887,8 @@ static int pkgmap_walk_dir(const char *abs_dir, const char *rel_dir, cbm_pkg_ent
886887 continue ;
887888 }
888889#endif
889- parsed += pkgmap_walk_dir (abs_path , rel_path , entries , depth + 1 );
890+ parsed += pkgmap_walk_dir (abs_path , rel_path , entries , depth + 1 , excluded_dirs ,
891+ excluded_count );
890892 continue ;
891893 }
892894 if (!S_ISREG (st .st_mode )) {
@@ -920,11 +922,12 @@ static int pkgmap_walk_dir(const char *abs_dir, const char *rel_dir, cbm_pkg_ent
920922 * Windows reparse points, so it cannot hang on directory junctions.
921923 * This is what lets bare workspace imports (e.g. "@org/pkg" declared in
922924 * an ignored package.json) resolve on Windows as well as POSIX. */
923- int cbm_pkgmap_scan_repo (const char * repo_path , cbm_pkg_entries_t * entries ) {
925+ int cbm_pkgmap_scan_repo (const char * repo_path , cbm_pkg_entries_t * entries , char * * excluded_dirs ,
926+ int excluded_count ) {
924927 if (!repo_path || !entries ) {
925928 return 0 ;
926929 }
927- int parsed = pkgmap_walk_dir (repo_path , "" , entries , 0 );
930+ int parsed = pkgmap_walk_dir (repo_path , "" , entries , 0 , excluded_dirs , excluded_count );
928931 cbm_log_info ("pkgmap.scan_repo" , "manifests" , pkgmap_itoa (parsed ));
929932 return parsed ;
930933}
@@ -961,7 +964,8 @@ CBMHashTable *cbm_pkgmap_build_from_files(const cbm_file_info_t *files, int file
961964 * (the canonical case: package.json, which is in IGNORED_JSON_FILES).
962965 * Falls back to the files[]-only behaviour if repo_path is NULL. */
963966CBMHashTable * cbm_pkgmap_build_from_repo (const char * repo_path , const cbm_file_info_t * files ,
964- int file_count , const char * project_name ) {
967+ int file_count , const char * project_name ,
968+ char * * excluded_dirs , int excluded_count ) {
965969 cbm_pkg_entries_t entries ;
966970 cbm_pkg_entries_init (& entries );
967971
@@ -985,7 +989,7 @@ CBMHashTable *cbm_pkgmap_build_from_repo(const char *repo_path, const cbm_file_i
985989 free (source );
986990 }
987991
988- int from_walk = cbm_pkgmap_scan_repo (repo_path , & entries );
992+ int from_walk = cbm_pkgmap_scan_repo (repo_path , & entries , excluded_dirs , excluded_count );
989993 cbm_log_info ("pkgmap.scan" , "manifests_from_files" , pkgmap_itoa (from_files ),
990994 "manifests_from_walk" , pkgmap_itoa (from_walk ), "entries" ,
991995 pkgmap_itoa (entries .count ));
0 commit comments