MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / walk_dir_process_file

Function walk_dir_process_file

src/discover/discover.c:1082–1107  ·  view source on GitHub ↗

Process a single regular file entry during directory walk. */

Source from the content-addressed store, hash-verified

1080
1081/* Process a single regular file entry during directory walk. */
1082static 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
1109typedef struct {
1110 char dir[CBM_SZ_4K];

Callers 1

walk_dir_process_entryFunction · 0.85

Calls 6

file_skip_reasonFunction · 0.85
tracked_has_fileFunction · 0.85
file_list_add_ignoredFunction · 0.85
detect_file_languageFunction · 0.85
sphinx_is_rstFunction · 0.85
fl_addFunction · 0.85

Tested by

no test coverage detected