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].
Commit
53aef2dee1b6b2940e53e480ca0e94b08faae6bd
Parent
1654456ef5aa8d3…
1 file changed
+24
-1
+24
-1
| --- src/vfile.c | ||
| +++ src/vfile.c | ||
| @@ -291,10 +291,31 @@ | ||
| 291 | 291 | unlink(zName); |
| 292 | 292 | } |
| 293 | 293 | db_finalize(&q); |
| 294 | 294 | db_multi_exec("UPDATE vfile SET mtime=NULL WHERE vid=%d AND mrid>0", vid); |
| 295 | 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 | + | |
| 296 | 317 | |
| 297 | 318 | /* |
| 298 | 319 | ** Load into table SFILE the name of every ordinary file in |
| 299 | 320 | ** the directory pPath. Omit the first nPrefix characters of |
| 300 | 321 | ** of pPath when inserting into the SFILE table. |
| @@ -346,11 +367,13 @@ | ||
| 346 | 367 | blob_appendf(pPath, "/%s", pEntry->d_name); |
| 347 | 368 | zPath = blob_str(pPath); |
| 348 | 369 | if( glob_match(pIgnore, &zPath[nPrefix+1]) ){ |
| 349 | 370 | /* do nothing */ |
| 350 | 371 | }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 | + } | |
| 352 | 375 | }else if( file_isfile(zPath) ){ |
| 353 | 376 | db_bind_text(&ins, ":file", &zPath[nPrefix+1]); |
| 354 | 377 | db_step(&ins); |
| 355 | 378 | db_reset(&ins); |
| 356 | 379 | } |
| 357 | 380 |
| --- 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 |