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

Function dg_step

tests/test_diagrams.c:1003–1023  ·  view source on GitHub ↗

An incremental index of `repo` into inc_db, a full one into a fresh * full_db: the same diagram layer. 0, or -1 after printing the difference. */

Source from the content-addressed store, hash-verified

1001/* An incremental index of `repo` into inc_db, a full one into a fresh
1002 * full_db: the same diagram layer. 0, or -1 after printing the difference. */
1003static int dg_step(const char *repo, const char *inc_db, const char *full_db, const char *what) {
1004 if (dm_index(repo, inc_db, NULL) != 0) {
1005 printf(" %s: incremental index failed\n", what);
1006 return -1;
1007 }
1008 dm_unlink_db(full_db);
1009 if (dm_index(repo, full_db, NULL) != 0) {
1010 printf(" %s: full index failed\n", what);
1011 return -1;
1012 }
1013 char *inc = dg_state(inc_db);
1014 char *full = dg_state(full_db);
1015 int rc = inc && full && strcmp(inc, full) == 0 && full[0] ? 0 : -1;
1016 if (rc != 0) {
1017 printf(" %s: incremental != full\n--- incremental\n%s--- full\n%s", what,
1018 inc ? inc : "(null)", full ? full : "(null)");
1019 }
1020 free(inc);
1021 free(full);
1022 return rc;
1023}
1024
1025static void dg_write_all(const char *repo, int round) {
1026 char text[1024];

Callers 1

test_diagrams.cFile · 0.85

Calls 3

dm_indexFunction · 0.85
dm_unlink_dbFunction · 0.85
dg_stateFunction · 0.85

Tested by

no test coverage detected