Fossil SCM

Commands that recursively descend through directory hierarchies (such as "fossil extra", "fossil clean", or "fossil addremove") will now ignore nested checkouts. Ticket [b49849a350d040bc].

drh 2011-04-27 14:23 trunk
Commit 53aef2dee1b6b2940e53e480ca0e94b08faae6bd
1 file changed +24 -1
+24 -1
--- src/vfile.c
+++ src/vfile.c
@@ -291,10 +291,31 @@
291291
unlink(zName);
292292
}
293293
db_finalize(&q);
294294
db_multi_exec("UPDATE vfile SET mtime=NULL WHERE vid=%d AND mrid>0", vid);
295295
}
296
+
297
+/*
298
+** Check to see if the directory named in zPath is the top of a checkout.
299
+** In other words, check to see if directory pPath contains a file named
300
+** "_FOSSIL_" or ".fos". Return true or false.
301
+*/
302
+int vfile_top_of_checkout(const char *zPath){
303
+ char *zFile;
304
+ int fileFound = 0;
305
+
306
+ zFile = mprintf("%s/_FOSSIL_");
307
+ fileFound = file_size(zFile)>=1024;
308
+ fossil_free(zFile);
309
+ if( !fileFound ){
310
+ zFile = mprintf("%s/.fos");
311
+ fileFound = file_size(zFile)>=1024;
312
+ fossil_free(zFile);
313
+ }
314
+ return fileFound;
315
+}
316
+
296317
297318
/*
298319
** Load into table SFILE the name of every ordinary file in
299320
** the directory pPath. Omit the first nPrefix characters of
300321
** of pPath when inserting into the SFILE table.
@@ -346,11 +367,13 @@
346367
blob_appendf(pPath, "/%s", pEntry->d_name);
347368
zPath = blob_str(pPath);
348369
if( glob_match(pIgnore, &zPath[nPrefix+1]) ){
349370
/* do nothing */
350371
}else if( file_isdir(zPath)==1 ){
351
- vfile_scan(pPath, nPrefix, allFlag, pIgnore);
372
+ if( !vfile_top_of_checkout(zPath) ){
373
+ vfile_scan(pPath, nPrefix, allFlag, pIgnore);
374
+ }
352375
}else if( file_isfile(zPath) ){
353376
db_bind_text(&ins, ":file", &zPath[nPrefix+1]);
354377
db_step(&ins);
355378
db_reset(&ins);
356379
}
357380
--- src/vfile.c
+++ src/vfile.c
@@ -291,10 +291,31 @@
291 unlink(zName);
292 }
293 db_finalize(&q);
294 db_multi_exec("UPDATE vfile SET mtime=NULL WHERE vid=%d AND mrid>0", vid);
295 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
297 /*
298 ** Load into table SFILE the name of every ordinary file in
299 ** the directory pPath. Omit the first nPrefix characters of
300 ** of pPath when inserting into the SFILE table.
@@ -346,11 +367,13 @@
346 blob_appendf(pPath, "/%s", pEntry->d_name);
347 zPath = blob_str(pPath);
348 if( glob_match(pIgnore, &zPath[nPrefix+1]) ){
349 /* do nothing */
350 }else if( file_isdir(zPath)==1 ){
351 vfile_scan(pPath, nPrefix, allFlag, pIgnore);
 
 
352 }else if( file_isfile(zPath) ){
353 db_bind_text(&ins, ":file", &zPath[nPrefix+1]);
354 db_step(&ins);
355 db_reset(&ins);
356 }
357
--- src/vfile.c
+++ src/vfile.c
@@ -291,10 +291,31 @@
291 unlink(zName);
292 }
293 db_finalize(&q);
294 db_multi_exec("UPDATE vfile SET mtime=NULL WHERE vid=%d AND mrid>0", vid);
295 }
296
297 /*
298 ** Check to see if the directory named in zPath is the top of a checkout.
299 ** In other words, check to see if directory pPath contains a file named
300 ** "_FOSSIL_" or ".fos". Return true or false.
301 */
302 int vfile_top_of_checkout(const char *zPath){
303 char *zFile;
304 int fileFound = 0;
305
306 zFile = mprintf("%s/_FOSSIL_");
307 fileFound = file_size(zFile)>=1024;
308 fossil_free(zFile);
309 if( !fileFound ){
310 zFile = mprintf("%s/.fos");
311 fileFound = file_size(zFile)>=1024;
312 fossil_free(zFile);
313 }
314 return fileFound;
315 }
316
317
318 /*
319 ** Load into table SFILE the name of every ordinary file in
320 ** the directory pPath. Omit the first nPrefix characters of
321 ** of pPath when inserting into the SFILE table.
@@ -346,11 +367,13 @@
367 blob_appendf(pPath, "/%s", pEntry->d_name);
368 zPath = blob_str(pPath);
369 if( glob_match(pIgnore, &zPath[nPrefix+1]) ){
370 /* do nothing */
371 }else if( file_isdir(zPath)==1 ){
372 if( !vfile_top_of_checkout(zPath) ){
373 vfile_scan(pPath, nPrefix, allFlag, pIgnore);
374 }
375 }else if( file_isfile(zPath) ){
376 db_bind_text(&ins, ":file", &zPath[nPrefix+1]);
377 db_step(&ins);
378 db_reset(&ins);
379 }
380

Keyboard Shortcuts

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