Fossil SCM

Modify the add and addremove commands to honor the clean-glob setting with the ability to override it via the --clean option. Adjust versionable setting files accordingly.

mistachkin 2013-05-07 23:00 trunk
Commit 155acff4812e65c16085345233b7aa106c9fb001
--- .fossil-settings/clean-glob
+++ .fossil-settings/clean-glob
@@ -1,9 +1,19 @@
11
*.a
22
*.lib
3
+*.manifest
34
*.o
45
*.obj
6
+*.pdb
7
+*.res
58
Makefile
69
bld/*
710
wbld/*
11
+win/*.c
12
+win/*.h
13
+win/*.exe
14
+win/headers
15
+win/linkopts
816
autoconfig.h
917
config.log
18
+fossil
19
+fossil.exe
1020
1121
DELETED .fossil-settings/ignore-glob
--- .fossil-settings/clean-glob
+++ .fossil-settings/clean-glob
@@ -1,9 +1,19 @@
1 *.a
2 *.lib
 
3 *.o
4 *.obj
 
 
5 Makefile
6 bld/*
7 wbld/*
 
 
 
 
 
8 autoconfig.h
9 config.log
 
 
10
11 ELETED .fossil-settings/ignore-glob
--- .fossil-settings/clean-glob
+++ .fossil-settings/clean-glob
@@ -1,9 +1,19 @@
1 *.a
2 *.lib
3 *.manifest
4 *.o
5 *.obj
6 *.pdb
7 *.res
8 Makefile
9 bld/*
10 wbld/*
11 win/*.c
12 win/*.h
13 win/*.exe
14 win/headers
15 win/linkopts
16 autoconfig.h
17 config.log
18 fossil
19 fossil.exe
20
21 ELETED .fossil-settings/ignore-glob
D .fossil-settings/ignore-glob
-2
--- a/.fossil-settings/ignore-glob
+++ b/.fossil-settings/ignore-glob
@@ -1,2 +0,0 @@
1
-fossil
2
-fossil.exe
--- a/.fossil-settings/ignore-glob
+++ b/.fossil-settings/ignore-glob
@@ -1,2 +0,0 @@
1 fossil
2 fossil.exe
--- a/.fossil-settings/ignore-glob
+++ b/.fossil-settings/ignore-glob
@@ -1,2 +0,0 @@
 
 
+30 -11
--- src/add.c
+++ src/add.c
@@ -221,14 +221,15 @@
221221
**
222222
** When adding files or directories recursively, filenames that begin
223223
** with "." are excluded by default. To include such files, add
224224
** the "--dotfiles" option to the command-line.
225225
**
226
-** The --ignore option is a comma-separate list of glob patterns for files
227
-** to be excluded. Example: '*.o,*.obj,*.exe' If the --ignore option
228
-** does not appear on the command line then the "ignore-glob" setting is
229
-** used.
226
+** The --ignore and --clean options are comma-separate lists of glob patterns
227
+** for files to be excluded. Example: '*.o,*.obj,*.exe' If the --ignore
228
+** option does not appear on the command line then the "ignore-glob" setting
229
+** is used. If the --clean option does not appear on the command line then
230
+** the "clean-glob" setting is used.
230231
**
231232
** The --case-sensitive option determines whether or not filenames should
232233
** be treated case sensitive or not. If the option is not given, the default
233234
** depends on the global setting, or the operating system default, if not set.
234235
**
@@ -236,34 +237,42 @@
236237
**
237238
** --case-sensitive <BOOL> override case-sensitive setting
238239
** --dotfiles include files beginning with a dot (".")
239240
** --ignore <CSG> ignore files matching patterns from the
240241
** comma separated list of glob patterns.
242
+** --clean <CSG> also ignore files matching patterns from
243
+** the comma separated list of glob patterns.
241244
**
242245
** See also: addremove, rm
243246
*/
244247
void add_cmd(void){
245248
int i; /* Loop counter */
246249
int vid; /* Currently checked out version */
247250
int nRoot; /* Full path characters in g.zLocalRoot */
251
+ const char *zCleanFlag; /* The --clean option or clean-glob setting */
248252
const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */
249
- Glob *pIgnore; /* Ignore everything matching this glob pattern */
253
+ Glob *pIgnore, *pClean; /* Ignore everything matching the glob patterns */
250254
unsigned scanFlags = 0; /* Flags passed to vfile_scan() */
251255
256
+ zCleanFlag = find_option("clean",0,1);
252257
zIgnoreFlag = find_option("ignore",0,1);
253258
if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
254259
capture_case_sensitive_option();
255260
db_must_be_within_tree();
261
+ if( zCleanFlag==0 ){
262
+ zCleanFlag = db_get("clean-glob", 0);
263
+ }
256264
if( zIgnoreFlag==0 ){
257265
zIgnoreFlag = db_get("ignore-glob", 0);
258266
}
259267
vid = db_lget_int("checkout",0);
260268
if( vid==0 ){
261269
fossil_panic("no checkout to add to");
262270
}
263271
db_begin_transaction();
264272
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
273
+ pClean = glob_create(zCleanFlag);
265274
pIgnore = glob_create(zIgnoreFlag);
266275
nRoot = strlen(g.zLocalRoot);
267276
268277
/* Load the names of all files that are to be added into sfile temp table */
269278
for(i=2; i<g.argc; i++){
@@ -273,11 +282,11 @@
273282
274283
file_canonical_name(g.argv[i], &fullName, 0);
275284
zName = blob_str(&fullName);
276285
isDir = file_wd_isdir(zName);
277286
if( isDir==1 ){
278
- vfile_scan(&fullName, nRoot-1, scanFlags, pIgnore);
287
+ vfile_scan2(&fullName, nRoot-1, scanFlags, pClean, pIgnore);
279288
}else if( isDir==0 ){
280289
fossil_warning("not found: %s", zName);
281290
}else if( file_access(zName, R_OK) ){
282291
fossil_fatal("cannot open %s", zName);
283292
}else{
@@ -288,10 +297,11 @@
288297
);
289298
}
290299
blob_reset(&fullName);
291300
}
292301
glob_free(pIgnore);
302
+ glob_free(pClean);
293303
294304
add_files_in_sfile(vid);
295305
db_end_transaction(0);
296306
}
297307
@@ -443,13 +453,14 @@
443453
** as a separate step.
444454
**
445455
** Files and directories whose names begin with "." are ignored unless
446456
** the --dotfiles option is used.
447457
**
448
-** The --ignore option overrides the "ignore-glob" setting, as does the
449
-** --case-sensitive option with the "case-sensitive" setting. See the
450
-** documentation on the "settings" command for further information.
458
+** The --ignore option overrides the "ignore-glob" setting, as do the
459
+** --case-sensitive option with the "case-sensitive" setting and the
460
+** --clean option with the "clean-glob" setting. See the documentation
461
+** on the "settings" command for further information.
451462
**
452463
** The --test option shows what would happen without actually doing anything.
453464
**
454465
** This command can be used to track third party software.
455466
**
@@ -456,31 +467,37 @@
456467
** Options:
457468
** --case-sensitive <BOOL> override case-sensitive setting
458469
** --dotfiles include files beginning with a dot (".")
459470
** --ignore <CSG> ignore files matching patterns from the
460471
** comma separated list of glob patterns.
472
+** --clean <CSG> also ignore files matching patterns from
473
+** the comma separated list of glob patterns.
461474
** -n|--dry-run If given, display instead of run actions
462475
**
463476
** See also: add, rm
464477
*/
465478
void addremove_cmd(void){
466479
Blob path;
480
+ const char *zCleanFlag = find_option("clean",0,1);
467481
const char *zIgnoreFlag = find_option("ignore",0,1);
468482
unsigned scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0;
469483
int dryRunFlag = find_option("dry-run","n",0)!=0;
470484
int n;
471485
Stmt q;
472486
int vid;
473487
int nAdd = 0;
474488
int nDelete = 0;
475
- Glob *pIgnore;
489
+ Glob *pIgnore, *pClean;
476490
477491
if( !dryRunFlag ){
478492
dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
479493
}
480494
capture_case_sensitive_option();
481495
db_must_be_within_tree();
496
+ if( zCleanFlag==0 ){
497
+ zCleanFlag = db_get("clean-glob", 0);
498
+ }
482499
if( zIgnoreFlag==0 ){
483500
zIgnoreFlag = db_get("ignore-glob", 0);
484501
}
485502
vid = db_lget_int("checkout",0);
486503
if( vid==0 ){
@@ -496,13 +513,15 @@
496513
*/
497514
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
498515
n = strlen(g.zLocalRoot);
499516
blob_init(&path, g.zLocalRoot, n-1);
500517
/* now we read the complete file structure into a temp table */
518
+ pClean = glob_create(zCleanFlag);
501519
pIgnore = glob_create(zIgnoreFlag);
502
- vfile_scan(&path, blob_size(&path), scanFlags, pIgnore);
520
+ vfile_scan2(&path, blob_size(&path), scanFlags, pClean, pIgnore);
503521
glob_free(pIgnore);
522
+ glob_free(pClean);
504523
nAdd = add_files_in_sfile(vid);
505524
506525
/* step 2: search for missing files */
507526
db_prepare(&q,
508527
"SELECT pathname, %Q || pathname, deleted FROM vfile"
509528
--- src/add.c
+++ src/add.c
@@ -221,14 +221,15 @@
221 **
222 ** When adding files or directories recursively, filenames that begin
223 ** with "." are excluded by default. To include such files, add
224 ** the "--dotfiles" option to the command-line.
225 **
226 ** The --ignore option is a comma-separate list of glob patterns for files
227 ** to be excluded. Example: '*.o,*.obj,*.exe' If the --ignore option
228 ** does not appear on the command line then the "ignore-glob" setting is
229 ** used.
 
230 **
231 ** The --case-sensitive option determines whether or not filenames should
232 ** be treated case sensitive or not. If the option is not given, the default
233 ** depends on the global setting, or the operating system default, if not set.
234 **
@@ -236,34 +237,42 @@
236 **
237 ** --case-sensitive <BOOL> override case-sensitive setting
238 ** --dotfiles include files beginning with a dot (".")
239 ** --ignore <CSG> ignore files matching patterns from the
240 ** comma separated list of glob patterns.
 
 
241 **
242 ** See also: addremove, rm
243 */
244 void add_cmd(void){
245 int i; /* Loop counter */
246 int vid; /* Currently checked out version */
247 int nRoot; /* Full path characters in g.zLocalRoot */
 
248 const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */
249 Glob *pIgnore; /* Ignore everything matching this glob pattern */
250 unsigned scanFlags = 0; /* Flags passed to vfile_scan() */
251
 
252 zIgnoreFlag = find_option("ignore",0,1);
253 if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
254 capture_case_sensitive_option();
255 db_must_be_within_tree();
 
 
 
256 if( zIgnoreFlag==0 ){
257 zIgnoreFlag = db_get("ignore-glob", 0);
258 }
259 vid = db_lget_int("checkout",0);
260 if( vid==0 ){
261 fossil_panic("no checkout to add to");
262 }
263 db_begin_transaction();
264 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
 
265 pIgnore = glob_create(zIgnoreFlag);
266 nRoot = strlen(g.zLocalRoot);
267
268 /* Load the names of all files that are to be added into sfile temp table */
269 for(i=2; i<g.argc; i++){
@@ -273,11 +282,11 @@
273
274 file_canonical_name(g.argv[i], &fullName, 0);
275 zName = blob_str(&fullName);
276 isDir = file_wd_isdir(zName);
277 if( isDir==1 ){
278 vfile_scan(&fullName, nRoot-1, scanFlags, pIgnore);
279 }else if( isDir==0 ){
280 fossil_warning("not found: %s", zName);
281 }else if( file_access(zName, R_OK) ){
282 fossil_fatal("cannot open %s", zName);
283 }else{
@@ -288,10 +297,11 @@
288 );
289 }
290 blob_reset(&fullName);
291 }
292 glob_free(pIgnore);
 
293
294 add_files_in_sfile(vid);
295 db_end_transaction(0);
296 }
297
@@ -443,13 +453,14 @@
443 ** as a separate step.
444 **
445 ** Files and directories whose names begin with "." are ignored unless
446 ** the --dotfiles option is used.
447 **
448 ** The --ignore option overrides the "ignore-glob" setting, as does the
449 ** --case-sensitive option with the "case-sensitive" setting. See the
450 ** documentation on the "settings" command for further information.
 
451 **
452 ** The --test option shows what would happen without actually doing anything.
453 **
454 ** This command can be used to track third party software.
455 **
@@ -456,31 +467,37 @@
456 ** Options:
457 ** --case-sensitive <BOOL> override case-sensitive setting
458 ** --dotfiles include files beginning with a dot (".")
459 ** --ignore <CSG> ignore files matching patterns from the
460 ** comma separated list of glob patterns.
 
 
461 ** -n|--dry-run If given, display instead of run actions
462 **
463 ** See also: add, rm
464 */
465 void addremove_cmd(void){
466 Blob path;
 
467 const char *zIgnoreFlag = find_option("ignore",0,1);
468 unsigned scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0;
469 int dryRunFlag = find_option("dry-run","n",0)!=0;
470 int n;
471 Stmt q;
472 int vid;
473 int nAdd = 0;
474 int nDelete = 0;
475 Glob *pIgnore;
476
477 if( !dryRunFlag ){
478 dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
479 }
480 capture_case_sensitive_option();
481 db_must_be_within_tree();
 
 
 
482 if( zIgnoreFlag==0 ){
483 zIgnoreFlag = db_get("ignore-glob", 0);
484 }
485 vid = db_lget_int("checkout",0);
486 if( vid==0 ){
@@ -496,13 +513,15 @@
496 */
497 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
498 n = strlen(g.zLocalRoot);
499 blob_init(&path, g.zLocalRoot, n-1);
500 /* now we read the complete file structure into a temp table */
 
501 pIgnore = glob_create(zIgnoreFlag);
502 vfile_scan(&path, blob_size(&path), scanFlags, pIgnore);
503 glob_free(pIgnore);
 
504 nAdd = add_files_in_sfile(vid);
505
506 /* step 2: search for missing files */
507 db_prepare(&q,
508 "SELECT pathname, %Q || pathname, deleted FROM vfile"
509
--- src/add.c
+++ src/add.c
@@ -221,14 +221,15 @@
221 **
222 ** When adding files or directories recursively, filenames that begin
223 ** with "." are excluded by default. To include such files, add
224 ** the "--dotfiles" option to the command-line.
225 **
226 ** The --ignore and --clean options are comma-separate lists of glob patterns
227 ** for files to be excluded. Example: '*.o,*.obj,*.exe' If the --ignore
228 ** option does not appear on the command line then the "ignore-glob" setting
229 ** is used. If the --clean option does not appear on the command line then
230 ** the "clean-glob" setting is used.
231 **
232 ** The --case-sensitive option determines whether or not filenames should
233 ** be treated case sensitive or not. If the option is not given, the default
234 ** depends on the global setting, or the operating system default, if not set.
235 **
@@ -236,34 +237,42 @@
237 **
238 ** --case-sensitive <BOOL> override case-sensitive setting
239 ** --dotfiles include files beginning with a dot (".")
240 ** --ignore <CSG> ignore files matching patterns from the
241 ** comma separated list of glob patterns.
242 ** --clean <CSG> also ignore files matching patterns from
243 ** the comma separated list of glob patterns.
244 **
245 ** See also: addremove, rm
246 */
247 void add_cmd(void){
248 int i; /* Loop counter */
249 int vid; /* Currently checked out version */
250 int nRoot; /* Full path characters in g.zLocalRoot */
251 const char *zCleanFlag; /* The --clean option or clean-glob setting */
252 const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */
253 Glob *pIgnore, *pClean; /* Ignore everything matching the glob patterns */
254 unsigned scanFlags = 0; /* Flags passed to vfile_scan() */
255
256 zCleanFlag = find_option("clean",0,1);
257 zIgnoreFlag = find_option("ignore",0,1);
258 if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
259 capture_case_sensitive_option();
260 db_must_be_within_tree();
261 if( zCleanFlag==0 ){
262 zCleanFlag = db_get("clean-glob", 0);
263 }
264 if( zIgnoreFlag==0 ){
265 zIgnoreFlag = db_get("ignore-glob", 0);
266 }
267 vid = db_lget_int("checkout",0);
268 if( vid==0 ){
269 fossil_panic("no checkout to add to");
270 }
271 db_begin_transaction();
272 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
273 pClean = glob_create(zCleanFlag);
274 pIgnore = glob_create(zIgnoreFlag);
275 nRoot = strlen(g.zLocalRoot);
276
277 /* Load the names of all files that are to be added into sfile temp table */
278 for(i=2; i<g.argc; i++){
@@ -273,11 +282,11 @@
282
283 file_canonical_name(g.argv[i], &fullName, 0);
284 zName = blob_str(&fullName);
285 isDir = file_wd_isdir(zName);
286 if( isDir==1 ){
287 vfile_scan2(&fullName, nRoot-1, scanFlags, pClean, pIgnore);
288 }else if( isDir==0 ){
289 fossil_warning("not found: %s", zName);
290 }else if( file_access(zName, R_OK) ){
291 fossil_fatal("cannot open %s", zName);
292 }else{
@@ -288,10 +297,11 @@
297 );
298 }
299 blob_reset(&fullName);
300 }
301 glob_free(pIgnore);
302 glob_free(pClean);
303
304 add_files_in_sfile(vid);
305 db_end_transaction(0);
306 }
307
@@ -443,13 +453,14 @@
453 ** as a separate step.
454 **
455 ** Files and directories whose names begin with "." are ignored unless
456 ** the --dotfiles option is used.
457 **
458 ** The --ignore option overrides the "ignore-glob" setting, as do the
459 ** --case-sensitive option with the "case-sensitive" setting and the
460 ** --clean option with the "clean-glob" setting. See the documentation
461 ** on the "settings" command for further information.
462 **
463 ** The --test option shows what would happen without actually doing anything.
464 **
465 ** This command can be used to track third party software.
466 **
@@ -456,31 +467,37 @@
467 ** Options:
468 ** --case-sensitive <BOOL> override case-sensitive setting
469 ** --dotfiles include files beginning with a dot (".")
470 ** --ignore <CSG> ignore files matching patterns from the
471 ** comma separated list of glob patterns.
472 ** --clean <CSG> also ignore files matching patterns from
473 ** the comma separated list of glob patterns.
474 ** -n|--dry-run If given, display instead of run actions
475 **
476 ** See also: add, rm
477 */
478 void addremove_cmd(void){
479 Blob path;
480 const char *zCleanFlag = find_option("clean",0,1);
481 const char *zIgnoreFlag = find_option("ignore",0,1);
482 unsigned scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0;
483 int dryRunFlag = find_option("dry-run","n",0)!=0;
484 int n;
485 Stmt q;
486 int vid;
487 int nAdd = 0;
488 int nDelete = 0;
489 Glob *pIgnore, *pClean;
490
491 if( !dryRunFlag ){
492 dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
493 }
494 capture_case_sensitive_option();
495 db_must_be_within_tree();
496 if( zCleanFlag==0 ){
497 zCleanFlag = db_get("clean-glob", 0);
498 }
499 if( zIgnoreFlag==0 ){
500 zIgnoreFlag = db_get("ignore-glob", 0);
501 }
502 vid = db_lget_int("checkout",0);
503 if( vid==0 ){
@@ -496,13 +513,15 @@
513 */
514 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
515 n = strlen(g.zLocalRoot);
516 blob_init(&path, g.zLocalRoot, n-1);
517 /* now we read the complete file structure into a temp table */
518 pClean = glob_create(zCleanFlag);
519 pIgnore = glob_create(zIgnoreFlag);
520 vfile_scan2(&path, blob_size(&path), scanFlags, pClean, pIgnore);
521 glob_free(pIgnore);
522 glob_free(pClean);
523 nAdd = add_files_in_sfile(vid);
524
525 /* step 2: search for missing files */
526 db_prepare(&q,
527 "SELECT pathname, %Q || pathname, deleted FROM vfile"
528
+16 -4
--- src/vfile.c
+++ src/vfile.c
@@ -433,10 +433,20 @@
433433
** Any files or directories that match the glob pattern pIgnore are
434434
** excluded from the scan. Name matching occurs after the first
435435
** nPrefix characters are elided from the filename.
436436
*/
437437
void vfile_scan(Blob *pPath, int nPrefix, unsigned scanFlags, Glob *pIgnore){
438
+ vfile_scan2(pPath, nPrefix, scanFlags, pIgnore, 0);
439
+}
440
+
441
+void vfile_scan2(
442
+ Blob *pPath,
443
+ int nPrefix,
444
+ unsigned scanFlags,
445
+ Glob *pIgnore1,
446
+ Glob *pIgnore2
447
+){
438448
DIR *d;
439449
int origSize;
440450
const char *zDir;
441451
struct dirent *pEntry;
442452
int skipAll = 0;
@@ -443,13 +453,14 @@
443453
static Stmt ins;
444454
static int depth = 0;
445455
void *zNative;
446456
447457
origSize = blob_size(pPath);
448
- if( pIgnore ){
458
+ if( pIgnore1 || pIgnore2 ){
449459
blob_appendf(pPath, "/");
450
- if( glob_match(pIgnore, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
460
+ if( glob_match(pIgnore1, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
461
+ if( glob_match(pIgnore2, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
451462
blob_resize(pPath, origSize);
452463
}
453464
if( skipAll ) return;
454465
455466
if( depth==0 ){
@@ -474,15 +485,16 @@
474485
if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue;
475486
}
476487
zUtf8 = fossil_filename_to_utf8(pEntry->d_name);
477488
blob_appendf(pPath, "/%s", zUtf8);
478489
zPath = blob_str(pPath);
479
- if( glob_match(pIgnore, &zPath[nPrefix+1]) ){
490
+ if( glob_match(pIgnore1, &zPath[nPrefix+1]) ||
491
+ glob_match(pIgnore2, &zPath[nPrefix+1]) ){
480492
/* do nothing */
481493
}else if( file_wd_isdir(zPath)==1 ){
482494
if( !vfile_top_of_checkout(zPath) ){
483
- vfile_scan(pPath, nPrefix, scanFlags, pIgnore);
495
+ vfile_scan2(pPath, nPrefix, scanFlags, pIgnore1, pIgnore2);
484496
}
485497
}else if( file_wd_isfile_or_link(zPath) ){
486498
if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(zUtf8) ){
487499
db_bind_text(&ins, ":file", &zPath[nPrefix+1]);
488500
db_step(&ins);
489501
--- src/vfile.c
+++ src/vfile.c
@@ -433,10 +433,20 @@
433 ** Any files or directories that match the glob pattern pIgnore are
434 ** excluded from the scan. Name matching occurs after the first
435 ** nPrefix characters are elided from the filename.
436 */
437 void vfile_scan(Blob *pPath, int nPrefix, unsigned scanFlags, Glob *pIgnore){
 
 
 
 
 
 
 
 
 
 
438 DIR *d;
439 int origSize;
440 const char *zDir;
441 struct dirent *pEntry;
442 int skipAll = 0;
@@ -443,13 +453,14 @@
443 static Stmt ins;
444 static int depth = 0;
445 void *zNative;
446
447 origSize = blob_size(pPath);
448 if( pIgnore ){
449 blob_appendf(pPath, "/");
450 if( glob_match(pIgnore, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
 
451 blob_resize(pPath, origSize);
452 }
453 if( skipAll ) return;
454
455 if( depth==0 ){
@@ -474,15 +485,16 @@
474 if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue;
475 }
476 zUtf8 = fossil_filename_to_utf8(pEntry->d_name);
477 blob_appendf(pPath, "/%s", zUtf8);
478 zPath = blob_str(pPath);
479 if( glob_match(pIgnore, &zPath[nPrefix+1]) ){
 
480 /* do nothing */
481 }else if( file_wd_isdir(zPath)==1 ){
482 if( !vfile_top_of_checkout(zPath) ){
483 vfile_scan(pPath, nPrefix, scanFlags, pIgnore);
484 }
485 }else if( file_wd_isfile_or_link(zPath) ){
486 if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(zUtf8) ){
487 db_bind_text(&ins, ":file", &zPath[nPrefix+1]);
488 db_step(&ins);
489
--- src/vfile.c
+++ src/vfile.c
@@ -433,10 +433,20 @@
433 ** Any files or directories that match the glob pattern pIgnore are
434 ** excluded from the scan. Name matching occurs after the first
435 ** nPrefix characters are elided from the filename.
436 */
437 void vfile_scan(Blob *pPath, int nPrefix, unsigned scanFlags, Glob *pIgnore){
438 vfile_scan2(pPath, nPrefix, scanFlags, pIgnore, 0);
439 }
440
441 void vfile_scan2(
442 Blob *pPath,
443 int nPrefix,
444 unsigned scanFlags,
445 Glob *pIgnore1,
446 Glob *pIgnore2
447 ){
448 DIR *d;
449 int origSize;
450 const char *zDir;
451 struct dirent *pEntry;
452 int skipAll = 0;
@@ -443,13 +453,14 @@
453 static Stmt ins;
454 static int depth = 0;
455 void *zNative;
456
457 origSize = blob_size(pPath);
458 if( pIgnore1 || pIgnore2 ){
459 blob_appendf(pPath, "/");
460 if( glob_match(pIgnore1, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
461 if( glob_match(pIgnore2, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
462 blob_resize(pPath, origSize);
463 }
464 if( skipAll ) return;
465
466 if( depth==0 ){
@@ -474,15 +485,16 @@
485 if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue;
486 }
487 zUtf8 = fossil_filename_to_utf8(pEntry->d_name);
488 blob_appendf(pPath, "/%s", zUtf8);
489 zPath = blob_str(pPath);
490 if( glob_match(pIgnore1, &zPath[nPrefix+1]) ||
491 glob_match(pIgnore2, &zPath[nPrefix+1]) ){
492 /* do nothing */
493 }else if( file_wd_isdir(zPath)==1 ){
494 if( !vfile_top_of_checkout(zPath) ){
495 vfile_scan2(pPath, nPrefix, scanFlags, pIgnore1, pIgnore2);
496 }
497 }else if( file_wd_isfile_or_link(zPath) ){
498 if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(zUtf8) ){
499 db_bind_text(&ins, ":file", &zPath[nPrefix+1]);
500 db_step(&ins);
501

Keyboard Shortcuts

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