Process a single regular file entry during directory walk. */
| 1080 | |
| 1081 | /* Process a single regular file entry during directory walk. */ |
| 1082 | static void walk_dir_process_file(const char *abs_path, const char *rel_path, const char *name, |
| 1083 | const cbm_discover_opts_t *opts, |
| 1084 | const gitignore_link_t *ignore_chain, |
| 1085 | const cbm_gitignore_t *global_gi, |
| 1086 | const cbm_gitignore_t *cbmignore, const sphinx_suffixes_t *sphinx, |
| 1087 | bool in_ignored_dir, const struct stat *st, file_list_t *out) { |
| 1088 | const char *skip_reason = |
| 1089 | file_skip_reason(name, rel_path, opts, ignore_chain, global_gi, cbmignore, st->st_size, |
| 1090 | tracked_has_file(out->tracked, rel_path), in_ignored_dir); |
| 1091 | if (skip_reason) { |
| 1092 | /* Deliberately not indexed (#963) — record so callers can surface it. |
| 1093 | * Unsupported-language files below are NOT recorded: "no grammar for |
| 1094 | * this extension" is not an ignore decision, and listing every |
| 1095 | * README/asset would drown the signal. */ |
| 1096 | file_list_add_ignored(out, rel_path, skip_reason); |
| 1097 | return; |
| 1098 | } |
| 1099 | CBMLanguage lang = detect_file_language(name, abs_path); |
| 1100 | if (lang == CBM_LANG_COUNT && sphinx_is_rst(sphinx, name)) { |
| 1101 | lang = CBM_LANG_RST; /* its documentation set's source_suffix */ |
| 1102 | } |
| 1103 | if (lang == CBM_LANG_COUNT) { |
| 1104 | return; |
| 1105 | } |
| 1106 | fl_add(out, abs_path, rel_path, lang, st); |
| 1107 | } |
| 1108 | |
| 1109 | typedef struct { |
| 1110 | char dir[CBM_SZ_4K]; |
no test coverage detected