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

Function try_load_nested_gitignore

src/discover/discover.c:1135–1146  ·  view source on GitHub ↗

Build abs/rel paths and process one directory entry. */ Try to load a nested .gitignore from this directory. Returns owned pointer or * NULL. Every directory below the root is probed, whether or not an ancestor * already contributed a matcher: git stacks ALL .gitignore files on a path, and * skipping the deeper ones once a shallower one existed was the #1973 blow-up * (an EMPTY storage/.gitign

Source from the content-addressed store, hash-verified

1133 * of git-ignored dumps were discovered and indexed until the OOM killer hit).
1134 * The root's own .gitignore is loaded by cbm_discover (merged with info/exclude). */
1135static cbm_gitignore_t *try_load_nested_gitignore(const walk_frame_t *frame) {
1136 if (frame->prefix[0] == '\0') {
1137 return NULL;
1138 }
1139 char gi_path[CBM_SZ_4K];
1140 snprintf(gi_path, sizeof(gi_path), "%s/.gitignore", frame->dir);
1141 struct stat gi_st;
1142 if (wide_stat(gi_path, &gi_st) == 0 && S_ISREG(gi_st.st_mode)) {
1143 return cbm_gitignore_load(gi_path);
1144 }
1145 return NULL;
1146}
1147
1148/* Push a subdirectory onto the walk stack, inheriting local gitignore
1149 * context. Grows the stack geometrically; the caller's `parent` must not

Callers 1

walk_dirFunction · 0.85

Calls 2

wide_statFunction · 0.85
cbm_gitignore_loadFunction · 0.85

Tested by

no test coverage detected