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

Function walk_dir_process_entry

src/discover/discover.c:687–719  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

685}
686
687static void walk_dir_process_entry(cbm_dirent_t *entry, const walk_frame_t *frame,
688 const cbm_discover_opts_t *opts,
689 const cbm_gitignore_t *gitignore,
690 const cbm_gitignore_t *global_gi,
691 const cbm_gitignore_t *cbmignore, walk_frame_t *stack, int *top,
692 file_list_t *out) {
693 char abs_path[CBM_SZ_4K];
694 char rel_path[CBM_SZ_4K];
695 snprintf(abs_path, sizeof(abs_path), "%s/%s", frame->dir, entry->name);
696 if (frame->prefix[0] != '\0') {
697 snprintf(rel_path, sizeof(rel_path), "%s/%s", frame->prefix, entry->name);
698 } else {
699 snprintf(rel_path, sizeof(rel_path), "%s", entry->name);
700 }
701
702 struct stat st;
703 if (safe_stat(abs_path, &st) != 0) {
704 return;
705 }
706
707 if (S_ISDIR(st.st_mode)) {
708 if (!should_skip_directory(entry->name, rel_path, opts, gitignore, global_gi, cbmignore,
709 frame->local_gi, frame->local_gi_prefix)) {
710 walk_push_subdir(stack, top, abs_path, rel_path, frame);
711 } else {
712 /* Record the excluded subtree root so callers can report it (#411). */
713 file_list_add_excluded(out, rel_path);
714 }
715 } else if (S_ISREG(st.st_mode)) {
716 walk_dir_process_file(abs_path, rel_path, entry->name, opts, gitignore, global_gi,
717 cbmignore, frame->local_gi, frame->local_gi_prefix, st.st_size, out);
718 }
719}
720
721enum { GI_OWNED_CAP = 64 };
722

Callers 1

walk_dirFunction · 0.85

Calls 5

safe_statFunction · 0.85
should_skip_directoryFunction · 0.85
walk_push_subdirFunction · 0.85
file_list_add_excludedFunction · 0.85
walk_dir_process_fileFunction · 0.85

Tested by

no test coverage detected