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

Function join_root_relative

src/git/git_context.c:128–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128static char *join_root_relative(const char *root, const char *rel) {
129 if (!root || !root[0]) {
130 return git_strdup(rel);
131 }
132 int n = snprintf(NULL, 0, "%s/%s", root, rel);
133 if (n < 0) {
134 return NULL;
135 }
136 char *out = (char *)malloc((size_t)n + 1);
137 if (!out) {
138 return NULL;
139 }
140 snprintf(out, (size_t)n + 1, "%s/%s", root, rel);
141 return out;
142}
143
144/* Derive the canonical repo root.
145 *

Callers 1

derive_canonical_rootFunction · 0.85

Calls 1

git_strdupFunction · 0.85

Tested by

no test coverage detected