Fossil SCM
Prevent fals-posivitive in fingerprint check, when the current checkout is empty.
Commit
fd8816ecf6eeea11adb07e335419535c5d6a0bf4efa22f5eb09184e9dbcb877c
Parent
4edc1302a48fb1c…
1 file changed
+12
-6
M
src/db.c
+12
-6
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -4006,16 +4006,18 @@ | ||
| 4006 | 4006 | ** Also set "fingerprint" and "checkout-hash". |
| 4007 | 4007 | */ |
| 4008 | 4008 | void db_set_checkout(int rid){ |
| 4009 | 4009 | char *z; |
| 4010 | 4010 | db_lset_int("checkout", rid); |
| 4011 | - z = db_text(0,"SELECT uuid FROM blob WHERE rid=%d",rid); | |
| 4012 | - db_lset("checkout-hash", z); | |
| 4013 | - fossil_free(z); | |
| 4014 | - z = db_fingerprint(0, 1); | |
| 4015 | - db_lset("fingerprint", z); | |
| 4016 | - fossil_free(z); | |
| 4011 | + if (rid != 0) { | |
| 4012 | + z = db_text(0,"SELECT uuid FROM blob WHERE rid=%d",rid); | |
| 4013 | + db_lset("checkout-hash", z); | |
| 4014 | + fossil_free(z); | |
| 4015 | + z = db_fingerprint(0, 1); | |
| 4016 | + db_lset("fingerprint", z); | |
| 4017 | + fossil_free(z); | |
| 4018 | + } | |
| 4017 | 4019 | } |
| 4018 | 4020 | |
| 4019 | 4021 | /* |
| 4020 | 4022 | ** Verify that the fingerprint recorded in the "fingerprint" entry |
| 4021 | 4023 | ** of the VVAR table matches the fingerprint on the currently |
| @@ -4026,10 +4028,14 @@ | ||
| 4026 | 4028 | char *zCkout; /* The fingerprint recorded in the checkout database */ |
| 4027 | 4029 | char *zRepo; /* The fingerprint of the repository */ |
| 4028 | 4030 | int rc; /* Result */ |
| 4029 | 4031 | |
| 4030 | 4032 | zCkout = db_text(0,"SELECT value FROM localdb.vvar WHERE name='fingerprint'"); |
| 4033 | + if( !db_lget_int("checkout", 0) ){ | |
| 4034 | + /* We have an empty checkout, fingerprint is still NULL. */ | |
| 4035 | + return 2; | |
| 4036 | + } | |
| 4031 | 4037 | if( zCkout==0 ){ |
| 4032 | 4038 | /* This is an older checkout that does not record a fingerprint. |
| 4033 | 4039 | ** We have to assume everything is ok */ |
| 4034 | 4040 | return 2; |
| 4035 | 4041 | } |
| 4036 | 4042 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -4006,16 +4006,18 @@ | |
| 4006 | ** Also set "fingerprint" and "checkout-hash". |
| 4007 | */ |
| 4008 | void db_set_checkout(int rid){ |
| 4009 | char *z; |
| 4010 | db_lset_int("checkout", rid); |
| 4011 | z = db_text(0,"SELECT uuid FROM blob WHERE rid=%d",rid); |
| 4012 | db_lset("checkout-hash", z); |
| 4013 | fossil_free(z); |
| 4014 | z = db_fingerprint(0, 1); |
| 4015 | db_lset("fingerprint", z); |
| 4016 | fossil_free(z); |
| 4017 | } |
| 4018 | |
| 4019 | /* |
| 4020 | ** Verify that the fingerprint recorded in the "fingerprint" entry |
| 4021 | ** of the VVAR table matches the fingerprint on the currently |
| @@ -4026,10 +4028,14 @@ | |
| 4026 | char *zCkout; /* The fingerprint recorded in the checkout database */ |
| 4027 | char *zRepo; /* The fingerprint of the repository */ |
| 4028 | int rc; /* Result */ |
| 4029 | |
| 4030 | zCkout = db_text(0,"SELECT value FROM localdb.vvar WHERE name='fingerprint'"); |
| 4031 | if( zCkout==0 ){ |
| 4032 | /* This is an older checkout that does not record a fingerprint. |
| 4033 | ** We have to assume everything is ok */ |
| 4034 | return 2; |
| 4035 | } |
| 4036 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -4006,16 +4006,18 @@ | |
| 4006 | ** Also set "fingerprint" and "checkout-hash". |
| 4007 | */ |
| 4008 | void db_set_checkout(int rid){ |
| 4009 | char *z; |
| 4010 | db_lset_int("checkout", rid); |
| 4011 | if (rid != 0) { |
| 4012 | z = db_text(0,"SELECT uuid FROM blob WHERE rid=%d",rid); |
| 4013 | db_lset("checkout-hash", z); |
| 4014 | fossil_free(z); |
| 4015 | z = db_fingerprint(0, 1); |
| 4016 | db_lset("fingerprint", z); |
| 4017 | fossil_free(z); |
| 4018 | } |
| 4019 | } |
| 4020 | |
| 4021 | /* |
| 4022 | ** Verify that the fingerprint recorded in the "fingerprint" entry |
| 4023 | ** of the VVAR table matches the fingerprint on the currently |
| @@ -4026,10 +4028,14 @@ | |
| 4028 | char *zCkout; /* The fingerprint recorded in the checkout database */ |
| 4029 | char *zRepo; /* The fingerprint of the repository */ |
| 4030 | int rc; /* Result */ |
| 4031 | |
| 4032 | zCkout = db_text(0,"SELECT value FROM localdb.vvar WHERE name='fingerprint'"); |
| 4033 | if( !db_lget_int("checkout", 0) ){ |
| 4034 | /* We have an empty checkout, fingerprint is still NULL. */ |
| 4035 | return 2; |
| 4036 | } |
| 4037 | if( zCkout==0 ){ |
| 4038 | /* This is an older checkout that does not record a fingerprint. |
| 4039 | ** We have to assume everything is ok */ |
| 4040 | return 2; |
| 4041 | } |
| 4042 |