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

Function join_root_relative

src/git/git_context.c:113–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113static char *join_root_relative(const char *root, const char *rel) {
114 if (!root || !root[0]) {
115 return git_strdup(rel);
116 }
117 int n = snprintf(NULL, 0, "%s/%s", root, rel);
118 if (n < 0) {
119 return NULL;
120 }
121 char *out = (char *)malloc((size_t)n + 1);
122 if (!out) {
123 return NULL;
124 }
125 snprintf(out, (size_t)n + 1, "%s/%s", root, rel);
126 return out;
127}
128
129/* Derive the canonical repo root.
130 *

Callers 1

derive_canonical_rootFunction · 0.85

Calls 1

git_strdupFunction · 0.85

Tested by

no test coverage detected