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. */
| 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. */ |
| 1003 | static 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 | |
| 1025 | static void dg_write_all(const char *repo, int round) { |
| 1026 | char text[1024]; |
no test coverage detected