Fossil SCM

Enhance the "fossil extra" and "fossil clean" commands to restrict output to files and directories named on the command-line. Enhancement request ticket [967cedbf200f7].

drh 2013-06-20 11:46 trunk merge
Commit 39feb8926e6c6172ce1db717530dd96d6479f49b
3 files changed +2 -2 +62 -21 +7 -11
+2 -2
--- src/add.c
+++ src/add.c
@@ -283,11 +283,11 @@
283283
284284
file_canonical_name(g.argv[i], &fullName, 0);
285285
zName = blob_str(&fullName);
286286
isDir = file_wd_isdir(zName);
287287
if( isDir==1 ){
288
- vfile_scan2(&fullName, nRoot-1, scanFlags, pClean, pIgnore);
288
+ vfile_scan(&fullName, nRoot-1, scanFlags, pClean, pIgnore);
289289
}else if( isDir==0 ){
290290
fossil_warning("not found: %s", zName);
291291
}else if( file_access(zName, R_OK) ){
292292
fossil_fatal("cannot open %s", zName);
293293
}else{
@@ -523,11 +523,11 @@
523523
n = strlen(g.zLocalRoot);
524524
blob_init(&path, g.zLocalRoot, n-1);
525525
/* now we read the complete file structure into a temp table */
526526
pClean = glob_create(zCleanFlag);
527527
pIgnore = glob_create(zIgnoreFlag);
528
- vfile_scan2(&path, blob_size(&path), scanFlags, pClean, pIgnore);
528
+ vfile_scan(&path, blob_size(&path), scanFlags, pClean, pIgnore);
529529
glob_free(pIgnore);
530530
glob_free(pClean);
531531
nAdd = add_files_in_sfile(vid);
532532
533533
/* step 2: search for missing files */
534534
--- src/add.c
+++ src/add.c
@@ -283,11 +283,11 @@
283
284 file_canonical_name(g.argv[i], &fullName, 0);
285 zName = blob_str(&fullName);
286 isDir = file_wd_isdir(zName);
287 if( isDir==1 ){
288 vfile_scan2(&fullName, nRoot-1, scanFlags, pClean, pIgnore);
289 }else if( isDir==0 ){
290 fossil_warning("not found: %s", zName);
291 }else if( file_access(zName, R_OK) ){
292 fossil_fatal("cannot open %s", zName);
293 }else{
@@ -523,11 +523,11 @@
523 n = strlen(g.zLocalRoot);
524 blob_init(&path, g.zLocalRoot, n-1);
525 /* now we read the complete file structure into a temp table */
526 pClean = glob_create(zCleanFlag);
527 pIgnore = glob_create(zIgnoreFlag);
528 vfile_scan2(&path, blob_size(&path), scanFlags, pClean, pIgnore);
529 glob_free(pIgnore);
530 glob_free(pClean);
531 nAdd = add_files_in_sfile(vid);
532
533 /* step 2: search for missing files */
534
--- src/add.c
+++ src/add.c
@@ -283,11 +283,11 @@
283
284 file_canonical_name(g.argv[i], &fullName, 0);
285 zName = blob_str(&fullName);
286 isDir = file_wd_isdir(zName);
287 if( isDir==1 ){
288 vfile_scan(&fullName, nRoot-1, scanFlags, pClean, pIgnore);
289 }else if( isDir==0 ){
290 fossil_warning("not found: %s", zName);
291 }else if( file_access(zName, R_OK) ){
292 fossil_fatal("cannot open %s", zName);
293 }else{
@@ -523,11 +523,11 @@
523 n = strlen(g.zLocalRoot);
524 blob_init(&path, g.zLocalRoot, n-1);
525 /* now we read the complete file structure into a temp table */
526 pClean = glob_create(zCleanFlag);
527 pIgnore = glob_create(zIgnoreFlag);
528 vfile_scan(&path, blob_size(&path), scanFlags, pClean, pIgnore);
529 glob_free(pIgnore);
530 glob_free(pClean);
531 nAdd = add_files_in_sfile(vid);
532
533 /* step 2: search for missing files */
534
+62 -21
--- src/checkin.c
+++ src/checkin.c
@@ -297,17 +297,66 @@
297297
}
298298
free(zFullName);
299299
}
300300
db_finalize(&q);
301301
}
302
+
303
+/*
304
+** Create a TEMP table named SFILE and add all unmanaged files named on the command-line
305
+** to that table. If directories are named, then add all unmanged files contained
306
+** underneath those directories. If there are no files or directories named on the
307
+** command-line, then add all unmanaged files anywhere in the checkout.
308
+*/
309
+static void locate_unmanaged_files(
310
+ int argc, /* Number of command-line arguments to examine */
311
+ char **argv, /* values of command-line arguments */
312
+ unsigned scanFlags, /* Zero or more SCAN_xxx flags */
313
+ Glob *pIgnore1, /* Do not add files that match this GLOB */
314
+ Glob *pIgnore2 /* Omit files matching this GLOB too */
315
+){
316
+ Blob name; /* Name of a candidate file or directory */
317
+ char *zName; /* Name of a candidate file or directory */
318
+ int isDir; /* 1 for a directory, 0 if doesn't exist, 2 for anything else */
319
+ int i; /* Loop counter */
320
+ int nRoot; /* length of g.zLocalRoot */
321
+
322
+ db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
323
+ filename_collation());
324
+ nRoot = (int)strlen(g.zLocalRoot);
325
+ if( argc==0 ){
326
+ blob_init(&name, g.zLocalRoot, nRoot - 1);
327
+ vfile_scan(&name, blob_size(&name), scanFlags, pIgnore1, pIgnore2);
328
+ blob_reset(&name);
329
+ }else{
330
+ for(i=0; i<argc; i++){
331
+ file_canonical_name(argv[i], &name, 0);
332
+ zName = blob_str(&name);
333
+ isDir = file_wd_isdir(zName);
334
+ if( isDir==1 ){
335
+ vfile_scan(&name, nRoot-1, scanFlags, pIgnore1, pIgnore2);
336
+ }else if( isDir==0 ){
337
+ fossil_warning("not found: %s", zName);
338
+ }else if( file_access(zName, R_OK) ){
339
+ fossil_fatal("cannot open %s", zName);
340
+ }else{
341
+ db_multi_exec(
342
+ "INSERT OR IGNORE INTO sfile(x) VALUES(%Q)",
343
+ &zName[nRoot]
344
+ );
345
+ }
346
+ blob_reset(&name);
347
+ }
348
+ }
349
+}
302350
303351
/*
304352
** COMMAND: extras
305
-** Usage: %fossil extras ?OPTIONS?
353
+** Usage: %fossil extras ?OPTIONS? ?PATH1 ...?
306354
**
307355
** Print a list of all files in the source tree that are not part of
308
-** the current checkout. See also the "clean" command.
356
+** the current checkout. See also the "clean" command. If paths are
357
+** specified, only files in the given directories will be listed.
309358
**
310359
** Files and subdirectories whose names begin with "." are normally
311360
** ignored but can be included by adding the --dotfiles option.
312361
**
313362
** The GLOBPATTERN is a comma-separated list of GLOB expressions for
@@ -326,13 +375,11 @@
326375
** directory.
327376
**
328377
** See also: changes, clean, status
329378
*/
330379
void extra_cmd(void){
331
- Blob path;
332380
Stmt q;
333
- int n;
334381
const char *zIgnoreFlag = find_option("ignore",0,1);
335382
unsigned scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0;
336383
int cwdRelative = 0;
337384
Glob *pIgnore;
338385
Blob rewrittenPathname;
@@ -340,19 +387,15 @@
340387
341388
if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
342389
capture_case_sensitive_option();
343390
db_must_be_within_tree();
344391
cwdRelative = determine_cwd_relative_option();
345
- db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
346
- filename_collation());
347
- n = strlen(g.zLocalRoot);
348
- blob_init(&path, g.zLocalRoot, n-1);
349392
if( zIgnoreFlag==0 ){
350393
zIgnoreFlag = db_get("ignore-glob", 0);
351394
}
352395
pIgnore = glob_create(zIgnoreFlag);
353
- vfile_scan(&path, blob_size(&path), scanFlags, pIgnore);
396
+ locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, pIgnore, 0);
354397
glob_free(pIgnore);
355398
db_prepare(&q,
356399
"SELECT x FROM sfile"
357400
" WHERE x NOT IN (%s)"
358401
" ORDER BY 1",
@@ -377,15 +420,16 @@
377420
db_finalize(&q);
378421
}
379422
380423
/*
381424
** COMMAND: clean
382
-** Usage: %fossil clean ?OPTIONS?
425
+** Usage: %fossil clean ?OPTIONS? ?PATH1 ...?
383426
**
384427
** Delete all "extra" files in the source tree. "Extra" files are
385428
** files that are not officially part of the checkout. This operation
386
-** cannot be undone.
429
+** cannot be undone. If paths are specified, only the directories or
430
+** files specified will be considered for cleaning.
387431
**
388432
** You will be prompted before removing each eligible file unless the
389433
** --force flag is in use or it matches the --clean option. The
390434
** GLOBPATTERN specified by the "ignore-glob" setting is used if the
391435
** --ignore option is omitted, the same with "clean-glob" and --clean
@@ -417,14 +461,14 @@
417461
*/
418462
void clean_cmd(void){
419463
int allFlag, dryRunFlag, verboseFlag;
420464
unsigned scanFlags = 0;
421465
const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag;
422
- Blob path, repo;
466
+ Blob repo;
423467
Stmt q;
424
- int n;
425468
Glob *pIgnore, *pKeep, *pClean;
469
+ int nRoot;
426470
427471
dryRunFlag = find_option("dry-run","n",0)!=0;
428472
if( !dryRunFlag ){
429473
dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
430474
}
@@ -445,18 +489,14 @@
445489
}
446490
if( zCleanFlag==0 ){
447491
zCleanFlag = db_get("clean-glob", 0);
448492
}
449493
verify_all_options();
450
- db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
451
- filename_collation());
452
- n = strlen(g.zLocalRoot);
453
- blob_init(&path, g.zLocalRoot, n-1);
454494
pIgnore = glob_create(zIgnoreFlag);
455495
pKeep = glob_create(zKeepFlag);
456496
pClean = glob_create(zCleanFlag);
457
- vfile_scan2(&path, blob_size(&path), scanFlags, pIgnore, pKeep);
497
+ locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, pIgnore, pKeep);
458498
glob_free(pKeep);
459499
glob_free(pIgnore);
460500
db_prepare(&q,
461501
"SELECT %Q || x FROM sfile"
462502
" WHERE x NOT IN (%s)"
@@ -465,17 +505,18 @@
465505
);
466506
if( file_tree_name(g.zRepositoryName, &repo, 0) ){
467507
db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
468508
}
469509
db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)");
510
+ nRoot = (int)strlen(g.zLocalRoot);
470511
while( db_step(&q)==SQLITE_ROW ){
471512
const char *zName = db_column_text(&q, 0);
472
- if( !allFlag && !dryRunFlag && !glob_match(pClean, zName+n) ){
513
+ if( !allFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){
473514
Blob ans;
474515
char cReply;
475516
char *prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ",
476
- zName+n);
517
+ zName+nRoot);
477518
blob_zero(&ans);
478519
prompt_user(prompt, &ans);
479520
cReply = blob_str(&ans)[0];
480521
if( cReply=='a' || cReply=='A' ){
481522
allFlag = 1;
@@ -484,11 +525,11 @@
484525
continue;
485526
}
486527
blob_reset(&ans);
487528
}
488529
if( verboseFlag || dryRunFlag ){
489
- fossil_print("Removed unmanaged file: %s\n", zName+n);
530
+ fossil_print("Removed unmanaged file: %s\n", zName+nRoot);
490531
}
491532
if( !dryRunFlag ){
492533
file_delete(zName);
493534
}
494535
}
495536
--- src/checkin.c
+++ src/checkin.c
@@ -297,17 +297,66 @@
297 }
298 free(zFullName);
299 }
300 db_finalize(&q);
301 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
302
303 /*
304 ** COMMAND: extras
305 ** Usage: %fossil extras ?OPTIONS?
306 **
307 ** Print a list of all files in the source tree that are not part of
308 ** the current checkout. See also the "clean" command.
 
309 **
310 ** Files and subdirectories whose names begin with "." are normally
311 ** ignored but can be included by adding the --dotfiles option.
312 **
313 ** The GLOBPATTERN is a comma-separated list of GLOB expressions for
@@ -326,13 +375,11 @@
326 ** directory.
327 **
328 ** See also: changes, clean, status
329 */
330 void extra_cmd(void){
331 Blob path;
332 Stmt q;
333 int n;
334 const char *zIgnoreFlag = find_option("ignore",0,1);
335 unsigned scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0;
336 int cwdRelative = 0;
337 Glob *pIgnore;
338 Blob rewrittenPathname;
@@ -340,19 +387,15 @@
340
341 if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
342 capture_case_sensitive_option();
343 db_must_be_within_tree();
344 cwdRelative = determine_cwd_relative_option();
345 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
346 filename_collation());
347 n = strlen(g.zLocalRoot);
348 blob_init(&path, g.zLocalRoot, n-1);
349 if( zIgnoreFlag==0 ){
350 zIgnoreFlag = db_get("ignore-glob", 0);
351 }
352 pIgnore = glob_create(zIgnoreFlag);
353 vfile_scan(&path, blob_size(&path), scanFlags, pIgnore);
354 glob_free(pIgnore);
355 db_prepare(&q,
356 "SELECT x FROM sfile"
357 " WHERE x NOT IN (%s)"
358 " ORDER BY 1",
@@ -377,15 +420,16 @@
377 db_finalize(&q);
378 }
379
380 /*
381 ** COMMAND: clean
382 ** Usage: %fossil clean ?OPTIONS?
383 **
384 ** Delete all "extra" files in the source tree. "Extra" files are
385 ** files that are not officially part of the checkout. This operation
386 ** cannot be undone.
 
387 **
388 ** You will be prompted before removing each eligible file unless the
389 ** --force flag is in use or it matches the --clean option. The
390 ** GLOBPATTERN specified by the "ignore-glob" setting is used if the
391 ** --ignore option is omitted, the same with "clean-glob" and --clean
@@ -417,14 +461,14 @@
417 */
418 void clean_cmd(void){
419 int allFlag, dryRunFlag, verboseFlag;
420 unsigned scanFlags = 0;
421 const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag;
422 Blob path, repo;
423 Stmt q;
424 int n;
425 Glob *pIgnore, *pKeep, *pClean;
 
426
427 dryRunFlag = find_option("dry-run","n",0)!=0;
428 if( !dryRunFlag ){
429 dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
430 }
@@ -445,18 +489,14 @@
445 }
446 if( zCleanFlag==0 ){
447 zCleanFlag = db_get("clean-glob", 0);
448 }
449 verify_all_options();
450 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
451 filename_collation());
452 n = strlen(g.zLocalRoot);
453 blob_init(&path, g.zLocalRoot, n-1);
454 pIgnore = glob_create(zIgnoreFlag);
455 pKeep = glob_create(zKeepFlag);
456 pClean = glob_create(zCleanFlag);
457 vfile_scan2(&path, blob_size(&path), scanFlags, pIgnore, pKeep);
458 glob_free(pKeep);
459 glob_free(pIgnore);
460 db_prepare(&q,
461 "SELECT %Q || x FROM sfile"
462 " WHERE x NOT IN (%s)"
@@ -465,17 +505,18 @@
465 );
466 if( file_tree_name(g.zRepositoryName, &repo, 0) ){
467 db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
468 }
469 db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)");
 
470 while( db_step(&q)==SQLITE_ROW ){
471 const char *zName = db_column_text(&q, 0);
472 if( !allFlag && !dryRunFlag && !glob_match(pClean, zName+n) ){
473 Blob ans;
474 char cReply;
475 char *prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ",
476 zName+n);
477 blob_zero(&ans);
478 prompt_user(prompt, &ans);
479 cReply = blob_str(&ans)[0];
480 if( cReply=='a' || cReply=='A' ){
481 allFlag = 1;
@@ -484,11 +525,11 @@
484 continue;
485 }
486 blob_reset(&ans);
487 }
488 if( verboseFlag || dryRunFlag ){
489 fossil_print("Removed unmanaged file: %s\n", zName+n);
490 }
491 if( !dryRunFlag ){
492 file_delete(zName);
493 }
494 }
495
--- src/checkin.c
+++ src/checkin.c
@@ -297,17 +297,66 @@
297 }
298 free(zFullName);
299 }
300 db_finalize(&q);
301 }
302
303 /*
304 ** Create a TEMP table named SFILE and add all unmanaged files named on the command-line
305 ** to that table. If directories are named, then add all unmanged files contained
306 ** underneath those directories. If there are no files or directories named on the
307 ** command-line, then add all unmanaged files anywhere in the checkout.
308 */
309 static void locate_unmanaged_files(
310 int argc, /* Number of command-line arguments to examine */
311 char **argv, /* values of command-line arguments */
312 unsigned scanFlags, /* Zero or more SCAN_xxx flags */
313 Glob *pIgnore1, /* Do not add files that match this GLOB */
314 Glob *pIgnore2 /* Omit files matching this GLOB too */
315 ){
316 Blob name; /* Name of a candidate file or directory */
317 char *zName; /* Name of a candidate file or directory */
318 int isDir; /* 1 for a directory, 0 if doesn't exist, 2 for anything else */
319 int i; /* Loop counter */
320 int nRoot; /* length of g.zLocalRoot */
321
322 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
323 filename_collation());
324 nRoot = (int)strlen(g.zLocalRoot);
325 if( argc==0 ){
326 blob_init(&name, g.zLocalRoot, nRoot - 1);
327 vfile_scan(&name, blob_size(&name), scanFlags, pIgnore1, pIgnore2);
328 blob_reset(&name);
329 }else{
330 for(i=0; i<argc; i++){
331 file_canonical_name(argv[i], &name, 0);
332 zName = blob_str(&name);
333 isDir = file_wd_isdir(zName);
334 if( isDir==1 ){
335 vfile_scan(&name, nRoot-1, scanFlags, pIgnore1, pIgnore2);
336 }else if( isDir==0 ){
337 fossil_warning("not found: %s", zName);
338 }else if( file_access(zName, R_OK) ){
339 fossil_fatal("cannot open %s", zName);
340 }else{
341 db_multi_exec(
342 "INSERT OR IGNORE INTO sfile(x) VALUES(%Q)",
343 &zName[nRoot]
344 );
345 }
346 blob_reset(&name);
347 }
348 }
349 }
350
351 /*
352 ** COMMAND: extras
353 ** Usage: %fossil extras ?OPTIONS? ?PATH1 ...?
354 **
355 ** Print a list of all files in the source tree that are not part of
356 ** the current checkout. See also the "clean" command. If paths are
357 ** specified, only files in the given directories will be listed.
358 **
359 ** Files and subdirectories whose names begin with "." are normally
360 ** ignored but can be included by adding the --dotfiles option.
361 **
362 ** The GLOBPATTERN is a comma-separated list of GLOB expressions for
@@ -326,13 +375,11 @@
375 ** directory.
376 **
377 ** See also: changes, clean, status
378 */
379 void extra_cmd(void){
 
380 Stmt q;
 
381 const char *zIgnoreFlag = find_option("ignore",0,1);
382 unsigned scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0;
383 int cwdRelative = 0;
384 Glob *pIgnore;
385 Blob rewrittenPathname;
@@ -340,19 +387,15 @@
387
388 if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
389 capture_case_sensitive_option();
390 db_must_be_within_tree();
391 cwdRelative = determine_cwd_relative_option();
 
 
 
 
392 if( zIgnoreFlag==0 ){
393 zIgnoreFlag = db_get("ignore-glob", 0);
394 }
395 pIgnore = glob_create(zIgnoreFlag);
396 locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, pIgnore, 0);
397 glob_free(pIgnore);
398 db_prepare(&q,
399 "SELECT x FROM sfile"
400 " WHERE x NOT IN (%s)"
401 " ORDER BY 1",
@@ -377,15 +420,16 @@
420 db_finalize(&q);
421 }
422
423 /*
424 ** COMMAND: clean
425 ** Usage: %fossil clean ?OPTIONS? ?PATH1 ...?
426 **
427 ** Delete all "extra" files in the source tree. "Extra" files are
428 ** files that are not officially part of the checkout. This operation
429 ** cannot be undone. If paths are specified, only the directories or
430 ** files specified will be considered for cleaning.
431 **
432 ** You will be prompted before removing each eligible file unless the
433 ** --force flag is in use or it matches the --clean option. The
434 ** GLOBPATTERN specified by the "ignore-glob" setting is used if the
435 ** --ignore option is omitted, the same with "clean-glob" and --clean
@@ -417,14 +461,14 @@
461 */
462 void clean_cmd(void){
463 int allFlag, dryRunFlag, verboseFlag;
464 unsigned scanFlags = 0;
465 const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag;
466 Blob repo;
467 Stmt q;
 
468 Glob *pIgnore, *pKeep, *pClean;
469 int nRoot;
470
471 dryRunFlag = find_option("dry-run","n",0)!=0;
472 if( !dryRunFlag ){
473 dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
474 }
@@ -445,18 +489,14 @@
489 }
490 if( zCleanFlag==0 ){
491 zCleanFlag = db_get("clean-glob", 0);
492 }
493 verify_all_options();
 
 
 
 
494 pIgnore = glob_create(zIgnoreFlag);
495 pKeep = glob_create(zKeepFlag);
496 pClean = glob_create(zCleanFlag);
497 locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, pIgnore, pKeep);
498 glob_free(pKeep);
499 glob_free(pIgnore);
500 db_prepare(&q,
501 "SELECT %Q || x FROM sfile"
502 " WHERE x NOT IN (%s)"
@@ -465,17 +505,18 @@
505 );
506 if( file_tree_name(g.zRepositoryName, &repo, 0) ){
507 db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
508 }
509 db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)");
510 nRoot = (int)strlen(g.zLocalRoot);
511 while( db_step(&q)==SQLITE_ROW ){
512 const char *zName = db_column_text(&q, 0);
513 if( !allFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){
514 Blob ans;
515 char cReply;
516 char *prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ",
517 zName+nRoot);
518 blob_zero(&ans);
519 prompt_user(prompt, &ans);
520 cReply = blob_str(&ans)[0];
521 if( cReply=='a' || cReply=='A' ){
522 allFlag = 1;
@@ -484,11 +525,11 @@
525 continue;
526 }
527 blob_reset(&ans);
528 }
529 if( verboseFlag || dryRunFlag ){
530 fossil_print("Removed unmanaged file: %s\n", zName+nRoot);
531 }
532 if( !dryRunFlag ){
533 file_delete(zName);
534 }
535 }
536
+7 -11
--- src/vfile.c
+++ src/vfile.c
@@ -432,20 +432,16 @@
432432
**
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
*/
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
437
+void vfile_scan(
438
+ Blob *pPath, /* Directory to be scanned */
439
+ int nPrefix, /* Number of bytes in directory name */
440
+ unsigned scanFlags, /* Zero or more SCAN_xxx flags */
441
+ Glob *pIgnore1, /* Do not add files that match this GLOB */
442
+ Glob *pIgnore2 /* Omit files matching this GLOB too */
447443
){
448444
DIR *d;
449445
int origSize;
450446
const char *zDir;
451447
struct dirent *pEntry;
@@ -490,11 +486,11 @@
490486
if( glob_match(pIgnore1, &zPath[nPrefix+1]) ||
491487
glob_match(pIgnore2, &zPath[nPrefix+1]) ){
492488
/* do nothing */
493489
}else if( file_wd_isdir(zPath)==1 ){
494490
if( !vfile_top_of_checkout(zPath) ){
495
- vfile_scan2(pPath, nPrefix, scanFlags, pIgnore1, pIgnore2);
491
+ vfile_scan(pPath, nPrefix, scanFlags, pIgnore1, pIgnore2);
496492
}
497493
}else if( file_wd_isfile_or_link(zPath) ){
498494
if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(zUtf8) ){
499495
db_bind_text(&ins, ":file", &zPath[nPrefix+1]);
500496
db_step(&ins);
501497
--- src/vfile.c
+++ src/vfile.c
@@ -432,20 +432,16 @@
432 **
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;
@@ -490,11 +486,11 @@
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
--- src/vfile.c
+++ src/vfile.c
@@ -432,20 +432,16 @@
432 **
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(
438 Blob *pPath, /* Directory to be scanned */
439 int nPrefix, /* Number of bytes in directory name */
440 unsigned scanFlags, /* Zero or more SCAN_xxx flags */
441 Glob *pIgnore1, /* Do not add files that match this GLOB */
442 Glob *pIgnore2 /* Omit files matching this GLOB too */
 
 
 
 
443 ){
444 DIR *d;
445 int origSize;
446 const char *zDir;
447 struct dirent *pEntry;
@@ -490,11 +486,11 @@
486 if( glob_match(pIgnore1, &zPath[nPrefix+1]) ||
487 glob_match(pIgnore2, &zPath[nPrefix+1]) ){
488 /* do nothing */
489 }else if( file_wd_isdir(zPath)==1 ){
490 if( !vfile_top_of_checkout(zPath) ){
491 vfile_scan(pPath, nPrefix, scanFlags, pIgnore1, pIgnore2);
492 }
493 }else if( file_wd_isfile_or_link(zPath) ){
494 if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(zUtf8) ){
495 db_bind_text(&ins, ":file", &zPath[nPrefix+1]);
496 db_step(&ins);
497

Keyboard Shortcuts

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