Fossil SCM
If a file has been deleted from the filesystem, but not deleted by fossil, then make the "update" command restore that file. Ticket [7c3ca0eae8287]
Commit
63d5a4fe25ee850fad5a9725c312733ca137769a
Parent
5a6634c453eccfc…
2 files changed
+10
-4
-1
+10
-4
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -41,17 +41,23 @@ | ||
| 41 | 41 | ** there is a previous value. |
| 42 | 42 | ** |
| 43 | 43 | ** Return the number of errors. No error messages are generated. |
| 44 | 44 | */ |
| 45 | 45 | static int getStat(const char *zFilename){ |
| 46 | + int rc = 0; | |
| 46 | 47 | if( zFilename==0 ){ |
| 47 | - if( fileStatValid==0 ) return 1; | |
| 48 | + if( fileStatValid==0 ) rc = 1; | |
| 48 | 49 | }else{ |
| 49 | - if( stat(zFilename, &fileStat)!=0 ) return 1; | |
| 50 | - fileStatValid = 1; | |
| 50 | + if( stat(zFilename, &fileStat)!=0 ){ | |
| 51 | + fileStatValid = 0; | |
| 52 | + rc = 1; | |
| 53 | + }else{ | |
| 54 | + fileStatValid = 1; | |
| 55 | + rc = 0; | |
| 56 | + } | |
| 51 | 57 | } |
| 52 | - return 0; | |
| 58 | + return rc; | |
| 53 | 59 | } |
| 54 | 60 | |
| 55 | 61 | |
| 56 | 62 | /* |
| 57 | 63 | ** Return the size of a file in bytes. Return -1 if the file does not |
| 58 | 64 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -41,17 +41,23 @@ | |
| 41 | ** there is a previous value. |
| 42 | ** |
| 43 | ** Return the number of errors. No error messages are generated. |
| 44 | */ |
| 45 | static int getStat(const char *zFilename){ |
| 46 | if( zFilename==0 ){ |
| 47 | if( fileStatValid==0 ) return 1; |
| 48 | }else{ |
| 49 | if( stat(zFilename, &fileStat)!=0 ) return 1; |
| 50 | fileStatValid = 1; |
| 51 | } |
| 52 | return 0; |
| 53 | } |
| 54 | |
| 55 | |
| 56 | /* |
| 57 | ** Return the size of a file in bytes. Return -1 if the file does not |
| 58 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -41,17 +41,23 @@ | |
| 41 | ** there is a previous value. |
| 42 | ** |
| 43 | ** Return the number of errors. No error messages are generated. |
| 44 | */ |
| 45 | static int getStat(const char *zFilename){ |
| 46 | int rc = 0; |
| 47 | if( zFilename==0 ){ |
| 48 | if( fileStatValid==0 ) rc = 1; |
| 49 | }else{ |
| 50 | if( stat(zFilename, &fileStat)!=0 ){ |
| 51 | fileStatValid = 0; |
| 52 | rc = 1; |
| 53 | }else{ |
| 54 | fileStatValid = 1; |
| 55 | rc = 0; |
| 56 | } |
| 57 | } |
| 58 | return rc; |
| 59 | } |
| 60 | |
| 61 | |
| 62 | /* |
| 63 | ** Return the size of a file in bytes. Return -1 if the file does not |
| 64 |
-1
| --- src/vfile.c | ||
| +++ src/vfile.c | ||
| @@ -182,11 +182,10 @@ | ||
| 182 | 182 | }else if( rid==0 ){ |
| 183 | 183 | chnged = 1; |
| 184 | 184 | } |
| 185 | 185 | if( chnged!=1 ){ |
| 186 | 186 | currentMtime = file_mtime(0); |
| 187 | - assert( currentMtime>0 ); | |
| 188 | 187 | } |
| 189 | 188 | if( chnged!=1 && (checkMtime==0 || currentMtime!=oldMtime) ){ |
| 190 | 189 | db_ephemeral_blob(&q, 5, &origCksum); |
| 191 | 190 | if( sha1sum_file(zName, &fileCksum) ){ |
| 192 | 191 | blob_zero(&fileCksum); |
| 193 | 192 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -182,11 +182,10 @@ | |
| 182 | }else if( rid==0 ){ |
| 183 | chnged = 1; |
| 184 | } |
| 185 | if( chnged!=1 ){ |
| 186 | currentMtime = file_mtime(0); |
| 187 | assert( currentMtime>0 ); |
| 188 | } |
| 189 | if( chnged!=1 && (checkMtime==0 || currentMtime!=oldMtime) ){ |
| 190 | db_ephemeral_blob(&q, 5, &origCksum); |
| 191 | if( sha1sum_file(zName, &fileCksum) ){ |
| 192 | blob_zero(&fileCksum); |
| 193 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -182,11 +182,10 @@ | |
| 182 | }else if( rid==0 ){ |
| 183 | chnged = 1; |
| 184 | } |
| 185 | if( chnged!=1 ){ |
| 186 | currentMtime = file_mtime(0); |
| 187 | } |
| 188 | if( chnged!=1 && (checkMtime==0 || currentMtime!=oldMtime) ){ |
| 189 | db_ephemeral_blob(&q, 5, &origCksum); |
| 190 | if( sha1sum_file(zName, &fileCksum) ){ |
| 191 | blob_zero(&fileCksum); |
| 192 |