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

Function join_root_relative

src/git/git_context.c:103–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103static char *join_root_relative(const char *root, const char *rel) {
104 if (!root || !root[0]) {
105 return git_strdup(rel);
106 }
107 int n = snprintf(NULL, 0, "%s/%s", root, rel);
108 if (n < 0) {
109 return NULL;
110 }
111 char *out = (char *)malloc((size_t)n + 1);
112 if (!out) {
113 return NULL;
114 }
115 snprintf(out, (size_t)n + 1, "%s/%s", root, rel);
116 return out;
117}
118
119/* Derive the canonical repo root.
120 *

Callers 1

derive_canonical_rootFunction · 0.85

Calls 1

git_strdupFunction · 0.85

Tested by

no test coverage detected