Fossil SCM

Fix the test-verify command so that it ignores phantoms.

drh 2007-08-01 15:13 trunk
Commit 1245b42ba3956b7f488125e5f2904f95f3b91833
1 file changed +5 -3
+5 -3
--- src/verify.c
+++ src/verify.c
@@ -35,21 +35,23 @@
3535
** Panic if anything goes wrong. If this procedure returns it means
3636
** that everything is OK.
3737
*/
3838
static void verify_rid(int rid){
3939
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
+ }
4043
blob_zero(&uuid);
4144
db_blob(&uuid, "SELECT uuid FROM blob WHERE rid=%d", rid);
4245
if( blob_size(&uuid)!=UUID_SIZE ){
4346
fossil_panic("not a valid rid: %d", rid);
4447
}
4548
content_get(rid, &content);
4649
sha1sum_blob(&content, &hash);
47
-/* blob_reset(&content); */
50
+ blob_reset(&content);
4851
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)",
5153
rid, &hash, &uuid);
5254
}
5355
blob_reset(&uuid);
5456
blob_reset(&hash);
5557
}
5658
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button