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]

drh 2010-02-25 12:58 trunk
Commit 63d5a4fe25ee850fad5a9725c312733ca137769a
2 files changed +10 -4 -1
+10 -4
--- src/file.c
+++ src/file.c
@@ -41,17 +41,23 @@
4141
** there is a previous value.
4242
**
4343
** Return the number of errors. No error messages are generated.
4444
*/
4545
static int getStat(const char *zFilename){
46
+ int rc = 0;
4647
if( zFilename==0 ){
47
- if( fileStatValid==0 ) return 1;
48
+ if( fileStatValid==0 ) rc = 1;
4849
}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
+ }
5157
}
52
- return 0;
58
+ return rc;
5359
}
5460
5561
5662
/*
5763
** Return the size of a file in bytes. Return -1 if the file does not
5864
--- 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
--- src/vfile.c
+++ src/vfile.c
@@ -182,11 +182,10 @@
182182
}else if( rid==0 ){
183183
chnged = 1;
184184
}
185185
if( chnged!=1 ){
186186
currentMtime = file_mtime(0);
187
- assert( currentMtime>0 );
188187
}
189188
if( chnged!=1 && (checkMtime==0 || currentMtime!=oldMtime) ){
190189
db_ephemeral_blob(&q, 5, &origCksum);
191190
if( sha1sum_file(zName, &fileCksum) ){
192191
blob_zero(&fileCksum);
193192
--- 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

Keyboard Shortcuts

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