Fossil SCM
Fix the test-verify command so that it ignores phantoms.
Commit
1245b42ba3956b7f488125e5f2904f95f3b91833
Parent
0238e54ff352117…
1 file changed
+5
-3
+5
-3
| --- src/verify.c | ||
| +++ src/verify.c | ||
| @@ -35,21 +35,23 @@ | ||
| 35 | 35 | ** Panic if anything goes wrong. If this procedure returns it means |
| 36 | 36 | ** that everything is OK. |
| 37 | 37 | */ |
| 38 | 38 | static void verify_rid(int rid){ |
| 39 | 39 | Blob uuid, hash, content; |
| 40 | + if( db_int(0, "SELECT size FROM blob WHERE rid=%d", rid)<0 ){ | |
| 41 | + return; /* No way to verify phantoms */ | |
| 42 | + } | |
| 40 | 43 | blob_zero(&uuid); |
| 41 | 44 | db_blob(&uuid, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 42 | 45 | if( blob_size(&uuid)!=UUID_SIZE ){ |
| 43 | 46 | fossil_panic("not a valid rid: %d", rid); |
| 44 | 47 | } |
| 45 | 48 | content_get(rid, &content); |
| 46 | 49 | sha1sum_blob(&content, &hash); |
| 47 | -/* blob_reset(&content); */ | |
| 50 | + blob_reset(&content); | |
| 48 | 51 | if( blob_compare(&uuid, &hash) ){ |
| 49 | -printf("content=[%s]\n", blob_str(&content)); | |
| 50 | - fossil_panic("hash of rid %d (%b) does not match its uuid (%b)", | |
| 52 | + fossil_fatal("hash of rid %d (%b) does not match its uuid (%b)", | |
| 51 | 53 | rid, &hash, &uuid); |
| 52 | 54 | } |
| 53 | 55 | blob_reset(&uuid); |
| 54 | 56 | blob_reset(&hash); |
| 55 | 57 | } |
| 56 | 58 |
| --- src/verify.c | |
| +++ src/verify.c | |
| @@ -35,21 +35,23 @@ | |
| 35 | ** Panic if anything goes wrong. If this procedure returns it means |
| 36 | ** that everything is OK. |
| 37 | */ |
| 38 | static void verify_rid(int rid){ |
| 39 | Blob uuid, hash, content; |
| 40 | blob_zero(&uuid); |
| 41 | db_blob(&uuid, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 42 | if( blob_size(&uuid)!=UUID_SIZE ){ |
| 43 | fossil_panic("not a valid rid: %d", rid); |
| 44 | } |
| 45 | content_get(rid, &content); |
| 46 | sha1sum_blob(&content, &hash); |
| 47 | /* blob_reset(&content); */ |
| 48 | if( blob_compare(&uuid, &hash) ){ |
| 49 | printf("content=[%s]\n", blob_str(&content)); |
| 50 | fossil_panic("hash of rid %d (%b) does not match its uuid (%b)", |
| 51 | rid, &hash, &uuid); |
| 52 | } |
| 53 | blob_reset(&uuid); |
| 54 | blob_reset(&hash); |
| 55 | } |
| 56 |
| --- src/verify.c | |
| +++ src/verify.c | |
| @@ -35,21 +35,23 @@ | |
| 35 | ** Panic if anything goes wrong. If this procedure returns it means |
| 36 | ** that everything is OK. |
| 37 | */ |
| 38 | static void verify_rid(int rid){ |
| 39 | Blob uuid, hash, content; |
| 40 | if( db_int(0, "SELECT size FROM blob WHERE rid=%d", rid)<0 ){ |
| 41 | return; /* No way to verify phantoms */ |
| 42 | } |
| 43 | blob_zero(&uuid); |
| 44 | db_blob(&uuid, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 45 | if( blob_size(&uuid)!=UUID_SIZE ){ |
| 46 | fossil_panic("not a valid rid: %d", rid); |
| 47 | } |
| 48 | content_get(rid, &content); |
| 49 | sha1sum_blob(&content, &hash); |
| 50 | blob_reset(&content); |
| 51 | if( blob_compare(&uuid, &hash) ){ |
| 52 | fossil_fatal("hash of rid %d (%b) does not match its uuid (%b)", |
| 53 | rid, &hash, &uuid); |
| 54 | } |
| 55 | blob_reset(&uuid); |
| 56 | blob_reset(&hash); |
| 57 | } |
| 58 |