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

Function gf_resolve

src/mcp/test_impact_git.c:702–716  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

700}
701
702static bool gf_resolve(cbm_git_facts_t *facts, const char *ref, char out[65],
703 cbm_git_facts_error_t *error) {
704 size_t n = gf_input_length(ref);
705 if (n == SIZE_MAX || n == 0 || ref[0] == '-')
706 return gf_error(error, CBM_GIT_FACTS_INVALID, "A bounded commit reference is required");
707 char *peel = cbm_arena_alloc(&facts->arena, n + sizeof("^{commit}"));
708 if (!peel)
709 return gf_error(error, CBM_GIT_FACTS_OOM, "Cannot retain commit reference");
710 memcpy(peel, ref, n);
711 memcpy(peel + n, "^{commit}", sizeof("^{commit}"));
712 const char *args[] = {"rev-parse", "--verify", "--end-of-options", peel};
713 gf_result_t result;
714 return gf_run(facts, args, 4, false, &result, error) &&
715 gf_oid_line(facts, &result.out, out, error);
716}
717
718#ifdef _WIN32
719/* MSYS2 and Cygwin git print absolute paths in their own namespace:

Callers 1

gf_open_identityFunction · 0.85

Calls 5

gf_input_lengthFunction · 0.85
gf_errorFunction · 0.85
gf_runFunction · 0.85
gf_oid_lineFunction · 0.85
cbm_arena_allocFunction · 0.50

Tested by

no test coverage detected