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

Function should_skip_file

src/discover/discover.c:529–567  ·  view source on GitHub ↗

Check if a regular file should be skipped (filters + gitignore + size). */

Source from the content-addressed store, hash-verified

527
528/* Check if a regular file should be skipped (filters + gitignore + size). */
529static bool should_skip_file(const char *entry_name, const char *rel_path,
530 const cbm_discover_opts_t *opts, const cbm_gitignore_t *gitignore,
531 const cbm_gitignore_t *global_gi, const cbm_gitignore_t *cbmignore,
532 const cbm_gitignore_t *local_gi, const char *local_gi_prefix,
533 off_t file_size) {
534 cbm_index_mode_t mode = opts ? opts->mode : CBM_MODE_FULL;
535 if (cbm_has_ignored_suffix(entry_name, mode)) {
536 return true;
537 }
538 if (cbm_should_skip_filename(entry_name, mode)) {
539 return true;
540 }
541 if (cbm_matches_fast_pattern(entry_name, mode)) {
542 return true;
543 }
544 if (gitignore && cbm_gitignore_matches(gitignore, rel_path, false)) {
545 return true;
546 }
547 bool global_ignored = global_gi && cbm_gitignore_matches(global_gi, rel_path, false);
548 if (local_gi) {
549 const char *lrel = local_rel_path(rel_path, local_gi_prefix);
550 if (cbm_gitignore_matches(local_gi, lrel, false)) {
551 return true;
552 }
553 }
554 if (cbmignore) {
555 int cbm_result = cbm_gitignore_match_result(cbmignore, rel_path, false);
556 if (cbm_result > 0) {
557 return true;
558 }
559 if (cbm_result < 0 && global_ignored) {
560 global_ignored = false;
561 }
562 }
563 if (opts && opts->max_file_size > 0 && file_size > opts->max_file_size) {
564 return true;
565 }
566 return global_ignored;
567}
568
569/* Detect language for a file, handling .m disambiguation and JSON filtering. */
570static CBMLanguage detect_file_language(const char *entry_name, const char *abs_path) {

Callers 1

walk_dir_process_fileFunction · 0.85

Calls 6

cbm_has_ignored_suffixFunction · 0.85
cbm_should_skip_filenameFunction · 0.85
cbm_matches_fast_patternFunction · 0.85
cbm_gitignore_matchesFunction · 0.85
local_rel_pathFunction · 0.85

Tested by

no test coverage detected