Fossil SCM
Check hash if mtime matches system time at the time we started checking.
Commit
f0aa85e302ee674e473d3bbcbaaad281881bde84698919ffb3995957a5aea0ce
Parent
b295f86db5417ce…
1 file changed
+4
-2
+4
-2
| --- src/vfile.c | ||
| +++ src/vfile.c | ||
| @@ -171,10 +171,11 @@ | ||
| 171 | 171 | ** If the mtime of a file has changed, we still examine the on-disk content |
| 172 | 172 | ** to see whether or not the edit was a null-edit. |
| 173 | 173 | */ |
| 174 | 174 | void vfile_check_signature(int vid, unsigned int cksigFlags){ |
| 175 | 175 | int nErr = 0; |
| 176 | + time_t now = time(0); | |
| 176 | 177 | Stmt q; |
| 177 | 178 | int useMtime = (cksigFlags & CKSIG_HASH)==0 |
| 178 | 179 | && db_get_boolean("mtime-changes", 1); |
| 179 | 180 | |
| 180 | 181 | db_begin_transaction(); |
| @@ -233,15 +234,16 @@ | ||
| 233 | 234 | const char *zUuid = db_column_text(&q, 5); |
| 234 | 235 | int nUuid = db_column_bytes(&q, 5); |
| 235 | 236 | assert( origSize==currentSize ); |
| 236 | 237 | if( hname_verify_file_hash(zName, zUuid, nUuid) ) chnged = 0; |
| 237 | 238 | }else if( (chnged==0 || chnged==2 || chnged==4) |
| 238 | - && (useMtime==0 || currentMtime!=oldMtime || currentMtime==time(0)) ){ | |
| 239 | + && (useMtime==0 || currentMtime!=oldMtime || oldMtime==now) ){ | |
| 239 | 240 | /* For files that were formerly believed to be unchanged or that were |
| 240 | 241 | ** changed by merging, if their mtime changes, or unconditionally |
| 241 | 242 | ** if --hash is used, check to see if they have been edited by |
| 242 | - ** looking at their artifact hashes */ | |
| 243 | + ** looking at their artifact hashes. Also check if mtime is current | |
| 244 | + ** in case a commit took place the same clock second checks started. */ | |
| 243 | 245 | const char *zUuid = db_column_text(&q, 5); |
| 244 | 246 | int nUuid = db_column_bytes(&q, 5); |
| 245 | 247 | assert( origSize==currentSize ); |
| 246 | 248 | if( !hname_verify_file_hash(zName, zUuid, nUuid) ) chnged = 1; |
| 247 | 249 | } |
| 248 | 250 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -171,10 +171,11 @@ | |
| 171 | ** If the mtime of a file has changed, we still examine the on-disk content |
| 172 | ** to see whether or not the edit was a null-edit. |
| 173 | */ |
| 174 | void vfile_check_signature(int vid, unsigned int cksigFlags){ |
| 175 | int nErr = 0; |
| 176 | Stmt q; |
| 177 | int useMtime = (cksigFlags & CKSIG_HASH)==0 |
| 178 | && db_get_boolean("mtime-changes", 1); |
| 179 | |
| 180 | db_begin_transaction(); |
| @@ -233,15 +234,16 @@ | |
| 233 | const char *zUuid = db_column_text(&q, 5); |
| 234 | int nUuid = db_column_bytes(&q, 5); |
| 235 | assert( origSize==currentSize ); |
| 236 | if( hname_verify_file_hash(zName, zUuid, nUuid) ) chnged = 0; |
| 237 | }else if( (chnged==0 || chnged==2 || chnged==4) |
| 238 | && (useMtime==0 || currentMtime!=oldMtime || currentMtime==time(0)) ){ |
| 239 | /* For files that were formerly believed to be unchanged or that were |
| 240 | ** changed by merging, if their mtime changes, or unconditionally |
| 241 | ** if --hash is used, check to see if they have been edited by |
| 242 | ** looking at their artifact hashes */ |
| 243 | const char *zUuid = db_column_text(&q, 5); |
| 244 | int nUuid = db_column_bytes(&q, 5); |
| 245 | assert( origSize==currentSize ); |
| 246 | if( !hname_verify_file_hash(zName, zUuid, nUuid) ) chnged = 1; |
| 247 | } |
| 248 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -171,10 +171,11 @@ | |
| 171 | ** If the mtime of a file has changed, we still examine the on-disk content |
| 172 | ** to see whether or not the edit was a null-edit. |
| 173 | */ |
| 174 | void vfile_check_signature(int vid, unsigned int cksigFlags){ |
| 175 | int nErr = 0; |
| 176 | time_t now = time(0); |
| 177 | Stmt q; |
| 178 | int useMtime = (cksigFlags & CKSIG_HASH)==0 |
| 179 | && db_get_boolean("mtime-changes", 1); |
| 180 | |
| 181 | db_begin_transaction(); |
| @@ -233,15 +234,16 @@ | |
| 234 | const char *zUuid = db_column_text(&q, 5); |
| 235 | int nUuid = db_column_bytes(&q, 5); |
| 236 | assert( origSize==currentSize ); |
| 237 | if( hname_verify_file_hash(zName, zUuid, nUuid) ) chnged = 0; |
| 238 | }else if( (chnged==0 || chnged==2 || chnged==4) |
| 239 | && (useMtime==0 || currentMtime!=oldMtime || oldMtime==now) ){ |
| 240 | /* For files that were formerly believed to be unchanged or that were |
| 241 | ** changed by merging, if their mtime changes, or unconditionally |
| 242 | ** if --hash is used, check to see if they have been edited by |
| 243 | ** looking at their artifact hashes. Also check if mtime is current |
| 244 | ** in case a commit took place the same clock second checks started. */ |
| 245 | const char *zUuid = db_column_text(&q, 5); |
| 246 | int nUuid = db_column_bytes(&q, 5); |
| 247 | assert( origSize==currentSize ); |
| 248 | if( !hname_verify_file_hash(zName, zUuid, nUuid) ) chnged = 1; |
| 249 | } |
| 250 |