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

Function changes_side_path

src/mcp/test_impact_changes.c:194–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192}
193
194static bool changes_side_path(changes_slice_t line, const cbm_change_file_t *file, bool old) {
195 const unsigned char *bytes = line.bytes + 4; /* checked ---/+++ prefix */
196 size_t length = line.length - 4;
197 bool absent = old ? file->status == 'A' : file->status == 'D';
198 if (absent) {
199 return length == 9 && memcmp(bytes, "/dev/null", 9) == 0;
200 }
201 if (length < 2 || bytes[0] != (old ? 'a' : 'b') || bytes[1] != '/') {
202 return false;
203 }
204 bytes += 2;
205 length -= 2;
206 /* Accept an exact trailing TAB delimiter after the known path, never
207 * timestamps, path truncation or another spelling. */
208 if (length > file->path_length && length - file->path_length == 1 &&
209 bytes[length - 1] == '\t') {
210 length--;
211 }
212 return length == file->path_length && memcmp(bytes, file->path, length) == 0;
213}
214
215/* The legacy reader discards the old start. Keep its old-side range from
216 * certifying an impossible nonempty range beginning at zero. */

Callers 1

changes_audit_headersFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected