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

Function rg_folder_key

src/ui/layout_regions.c:137–153  ·  view source on GitHub ↗

Folder key: the first two path components ("src/pipeline"), one for a * top-level directory, "." for repo-root files. */

Source from the content-addressed store, hash-verified

135/* Folder key: the first two path components ("src/pipeline"), one for a
136 * top-level directory, "." for repo-root files. */
137static void rg_folder_key(const char *path, char *out, size_t cap) {
138 if (!path || !path[0]) {
139 snprintf(out, cap, ".");
140 return;
141 }
142 const char *first = strchr(path, '/');
143 if (!first) {
144 snprintf(out, cap, ".");
145 return;
146 }
147 const char *second = strchr(first + 1, '/');
148 size_t len = second ? (size_t)(second - path) : (size_t)(first - path);
149 if (len >= cap)
150 len = cap - 1;
151 memcpy(out, path, len);
152 out[len] = '\0';
153}
154
155typedef struct {
156 int64_t id;

Callers 2

rg_assign_regionsFunction · 0.85
rg_map_all_nodesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected