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

Function cbm_gitignore_parse

src/discover/gitignore.c:70–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68/* ── Public API ──────────────────────────────────────────────────── */
69
70cbm_gitignore_t *cbm_gitignore_parse(const char *content) {
71 if (!content) {
72 return NULL;
73 }
74
75 cbm_gitignore_t *gi = calloc(CBM_ALLOC_ONE, sizeof(cbm_gitignore_t));
76 if (!gi) {
77 return NULL;
78 }
79
80 const char *line = content;
81 while (*line) {
82 /* Find end of line */
83 const char *eol = strchr(line, '\n');
84 int len = eol ? (int)(eol - line) : (int)strlen(line);
85
86 /* Skip comments and blank lines */
87 if (len > 0 && line[0] != '#') {
88 gi_add_pattern(gi, line, len);
89 }
90
91 if (!eol) {
92 break;
93 }
94 line = eol + SKIP_ONE;
95 }
96
97 return gi;
98}
99
100cbm_gitignore_t *cbm_gitignore_load(const char *path) {
101 if (!path) {

Callers 7

cbm_gitignore_loadFunction · 0.85
tc_parseFunction · 0.85
gic_semantic_oneFunction · 0.85
gic_attempt_caseFunction · 0.85
if_dependency_controlFunction · 0.85
test_gitignore.cFile · 0.85
repro_issue510.cFile · 0.85

Calls 1

gi_add_patternFunction · 0.85

Tested by 4

tc_parseFunction · 0.68
gic_semantic_oneFunction · 0.68
gic_attempt_caseFunction · 0.68
if_dependency_controlFunction · 0.68