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

Function gf_inventory_path

src/mcp/test_impact_git.c:1086–1103  ·  view source on GitHub ↗

Inventory paths are data, never argv or filesystem paths. Unlike blob * lookup, this validates only tree-path structure, retaining every literal * byte spelling so an unsupported relevant entry cannot silently disappear. */

Source from the content-addressed store, hash-verified

1084 * lookup, this validates only tree-path structure, retaining every literal
1085 * byte spelling so an unsupported relevant entry cannot silently disappear. */
1086static bool gf_inventory_path(cbm_git_facts_t *facts, const unsigned char *path, size_t n,
1087 cbm_git_facts_error_t *error) {
1088 if (!n || path[0] == '/')
1089 return gf_error(error, CBM_GIT_FACTS_COMMAND, "Malformed tracked-tree path");
1090 size_t begin = 0;
1091 for (size_t i = 0; i <= n; i++) {
1092 if ((i & 65535u) == 0 && !gf_gate(facts, error))
1093 return false;
1094 if (i != n && path[i] != '/')
1095 continue;
1096 size_t length = i - begin;
1097 if (!length || (length == 1 && path[begin] == '.') ||
1098 (length == 2 && path[begin] == '.' && path[begin + 1] == '.'))
1099 return gf_error(error, CBM_GIT_FACTS_COMMAND, "Malformed tracked-tree path");
1100 begin = i + 1;
1101 }
1102 return true;
1103}
1104
1105/* Parse one exact <mode> <type> <full-oid> TAB <path> NUL record. Bounds
1106 * come from captured length, never a guessed line or a strlen(path). */

Callers 2

gf_inventory_recordFunction · 0.85
gf_ancestor_names_validFunction · 0.85

Calls 2

gf_errorFunction · 0.85
gf_gateFunction · 0.85

Tested by

no test coverage detected