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

Function changes_path_valid

src/mcp/test_impact_changes.c:35–55  ·  view source on GitHub ↗

Git tree paths use '/' on every host; backslash/colon are literal bytes. */

Source from the content-addressed store, hash-verified

33
34/* Git tree paths use '/' on every host; backslash/colon are literal bytes. */
35static bool changes_path_valid(const unsigned char *path, size_t length) {
36 if (!length || path[0] == '/' || path[length - 1] == '/') {
37 return false;
38 }
39 size_t start = 0;
40 for (size_t i = 0; i <= length; i++) {
41 if (i < length && path[i] != '/') {
42 if (path[i] == 0) {
43 return false;
44 }
45 continue;
46 }
47 size_t component = i - start;
48 if (!component || (component == 1 && path[start] == '.') ||
49 (component == 2 && path[start] == '.' && path[start + 1] == '.')) {
50 return false;
51 }
52 start = i + 1;
53 }
54 return true;
55}
56
57static bool changes_record(const unsigned char *bytes, size_t length, size_t *offset, char *status,
58 changes_slice_t *path) {

Callers 3

changes_recordFunction · 0.85
changes_header_pathFunction · 0.85
changes_reconcileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected