Fossil SCM

Take over some improvements/fixes from the CleanX2 branch. Still not very well tested, so please don't look ;-)

jan.nijtmans 2013-10-02 14:45 cleanX-no-clean-glob merge
Commit b2a2ce5312be205727349b2421407e65f68a0293
+12 -6
--- src/checkin.c
+++ src/checkin.c
@@ -545,11 +545,11 @@
545545
** Compatibile with "git clean -x".
546546
**
547547
** See also: addremove, extra, status
548548
*/
549549
void clean_cmd(void){
550
- int allFileFlag, allDirFlag, dryRunFlag, extremeFlag, verboseFlag;
550
+ int allFileFlag, allDirFlag, dryRunFlag, verboseFlag, extremeFlag;
551551
int emptyDirsFlag, dirsOnlyFlag;
552552
unsigned scanFlags = 0;
553553
const char *zIgnoreFlag, *zKeepFlag;
554554
Glob *pIgnore, *pKeep;
555555
int nRoot;
@@ -559,11 +559,11 @@
559559
dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
560560
}
561561
extremeFlag = find_option("extreme","x",0)!=0;
562562
allFileFlag = allDirFlag = find_option("force","f",0)!=0;
563563
dirsOnlyFlag = find_option("dirsonly",0,0)!=0;
564
- emptyDirsFlag = dirsOnlyFlag || find_option("emptydirs","d",0)!=0;
564
+ emptyDirsFlag = find_option("emptydirs","d",0)!=0 || dirsOnlyFlag;
565565
if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
566566
if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
567567
if( find_option("allckouts",0,0)!=0 ) scanFlags |= SCAN_NESTED;
568568
zIgnoreFlag = find_option("ignore",0,1);
569569
verboseFlag = find_option("verbose","v",0)!=0;
@@ -600,11 +600,12 @@
600600
pKeep = glob_create(zKeepFlag);
601601
nRoot = (int)strlen(g.zLocalRoot);
602602
if( !dirsOnlyFlag ){
603603
Stmt q;
604604
Blob repo;
605
- locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, extremeFlag ? 0 : pIgnore);
605
+ locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags,
606
+ extremeFlag ? 0 : pIgnore);
606607
db_prepare(&q,
607608
"SELECT %Q || x FROM sfile"
608609
" WHERE x NOT IN (%s)"
609610
" ORDER BY 1",
610611
g.zLocalRoot, fossil_all_reserved_names(0)
@@ -613,10 +614,14 @@
613614
db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
614615
}
615616
db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)");
616617
while( db_step(&q)==SQLITE_ROW ){
617618
const char *zName = db_column_text(&q, 0);
619
+ if( glob_match(pKeep, zName+nRoot) ){
620
+ fossil_print("WARNING: KEPT file \"%s\" not removed\n", zName+nRoot);
621
+ continue;
622
+ }
618623
if( !allFileFlag && (!extremeFlag || !glob_match(pIgnore, zName+nRoot)) ){
619624
Blob ans;
620625
char cReply;
621626
char *prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ",
622627
zName+nRoot);
@@ -644,12 +649,13 @@
644649
if( emptyDirsFlag ){
645650
Glob *pEmptyDirs = glob_create(db_get("empty-dirs", 0));
646651
Stmt q;
647652
Blob root;
648653
blob_init(&root, g.zLocalRoot, nRoot - 1);
649
- vfile_dir_scan(&root, blob_size(&root), scanFlags, pIgnore, pKeep,
650
- pEmptyDirs);
654
+ vfile_dir_scan(&root, blob_size(&root), scanFlags,
655
+ extremeFlag ? 0 : pIgnore,
656
+ extremeFlag ? 0 : pEmptyDirs);
651657
blob_reset(&root);
652658
db_prepare(&q,
653659
"SELECT %Q || x FROM dscan_temp"
654660
" WHERE x NOT IN (%s) AND y = 0"
655661
" ORDER BY 1 DESC",
@@ -656,11 +662,11 @@
656662
g.zLocalRoot, fossil_all_reserved_names(0)
657663
);
658664
while( db_step(&q)==SQLITE_ROW ){
659665
const char *zName = db_column_text(&q, 0);
660666
if( glob_match(pKeep, zName+nRoot) ){
661
- fossil_print("WARNING: KEPT file \"%s\" not removed\n", zName+nRoot);
667
+ fossil_print("WARNING: KEPT directory \"%s\" not removed\n", zName+nRoot);
662668
continue;
663669
}
664670
if( !allDirFlag && (!extremeFlag || !glob_match(pIgnore, zName+nRoot)) ){
665671
Blob ans;
666672
char cReply;
667673
--- src/checkin.c
+++ src/checkin.c
@@ -545,11 +545,11 @@
545 ** Compatibile with "git clean -x".
546 **
547 ** See also: addremove, extra, status
548 */
549 void clean_cmd(void){
550 int allFileFlag, allDirFlag, dryRunFlag, extremeFlag, verboseFlag;
551 int emptyDirsFlag, dirsOnlyFlag;
552 unsigned scanFlags = 0;
553 const char *zIgnoreFlag, *zKeepFlag;
554 Glob *pIgnore, *pKeep;
555 int nRoot;
@@ -559,11 +559,11 @@
559 dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
560 }
561 extremeFlag = find_option("extreme","x",0)!=0;
562 allFileFlag = allDirFlag = find_option("force","f",0)!=0;
563 dirsOnlyFlag = find_option("dirsonly",0,0)!=0;
564 emptyDirsFlag = dirsOnlyFlag || find_option("emptydirs","d",0)!=0;
565 if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
566 if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
567 if( find_option("allckouts",0,0)!=0 ) scanFlags |= SCAN_NESTED;
568 zIgnoreFlag = find_option("ignore",0,1);
569 verboseFlag = find_option("verbose","v",0)!=0;
@@ -600,11 +600,12 @@
600 pKeep = glob_create(zKeepFlag);
601 nRoot = (int)strlen(g.zLocalRoot);
602 if( !dirsOnlyFlag ){
603 Stmt q;
604 Blob repo;
605 locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, extremeFlag ? 0 : pIgnore);
 
606 db_prepare(&q,
607 "SELECT %Q || x FROM sfile"
608 " WHERE x NOT IN (%s)"
609 " ORDER BY 1",
610 g.zLocalRoot, fossil_all_reserved_names(0)
@@ -613,10 +614,14 @@
613 db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
614 }
615 db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)");
616 while( db_step(&q)==SQLITE_ROW ){
617 const char *zName = db_column_text(&q, 0);
 
 
 
 
618 if( !allFileFlag && (!extremeFlag || !glob_match(pIgnore, zName+nRoot)) ){
619 Blob ans;
620 char cReply;
621 char *prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ",
622 zName+nRoot);
@@ -644,12 +649,13 @@
644 if( emptyDirsFlag ){
645 Glob *pEmptyDirs = glob_create(db_get("empty-dirs", 0));
646 Stmt q;
647 Blob root;
648 blob_init(&root, g.zLocalRoot, nRoot - 1);
649 vfile_dir_scan(&root, blob_size(&root), scanFlags, pIgnore, pKeep,
650 pEmptyDirs);
 
651 blob_reset(&root);
652 db_prepare(&q,
653 "SELECT %Q || x FROM dscan_temp"
654 " WHERE x NOT IN (%s) AND y = 0"
655 " ORDER BY 1 DESC",
@@ -656,11 +662,11 @@
656 g.zLocalRoot, fossil_all_reserved_names(0)
657 );
658 while( db_step(&q)==SQLITE_ROW ){
659 const char *zName = db_column_text(&q, 0);
660 if( glob_match(pKeep, zName+nRoot) ){
661 fossil_print("WARNING: KEPT file \"%s\" not removed\n", zName+nRoot);
662 continue;
663 }
664 if( !allDirFlag && (!extremeFlag || !glob_match(pIgnore, zName+nRoot)) ){
665 Blob ans;
666 char cReply;
667
--- src/checkin.c
+++ src/checkin.c
@@ -545,11 +545,11 @@
545 ** Compatibile with "git clean -x".
546 **
547 ** See also: addremove, extra, status
548 */
549 void clean_cmd(void){
550 int allFileFlag, allDirFlag, dryRunFlag, verboseFlag, extremeFlag;
551 int emptyDirsFlag, dirsOnlyFlag;
552 unsigned scanFlags = 0;
553 const char *zIgnoreFlag, *zKeepFlag;
554 Glob *pIgnore, *pKeep;
555 int nRoot;
@@ -559,11 +559,11 @@
559 dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
560 }
561 extremeFlag = find_option("extreme","x",0)!=0;
562 allFileFlag = allDirFlag = find_option("force","f",0)!=0;
563 dirsOnlyFlag = find_option("dirsonly",0,0)!=0;
564 emptyDirsFlag = find_option("emptydirs","d",0)!=0 || dirsOnlyFlag;
565 if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
566 if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
567 if( find_option("allckouts",0,0)!=0 ) scanFlags |= SCAN_NESTED;
568 zIgnoreFlag = find_option("ignore",0,1);
569 verboseFlag = find_option("verbose","v",0)!=0;
@@ -600,11 +600,12 @@
600 pKeep = glob_create(zKeepFlag);
601 nRoot = (int)strlen(g.zLocalRoot);
602 if( !dirsOnlyFlag ){
603 Stmt q;
604 Blob repo;
605 locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags,
606 extremeFlag ? 0 : pIgnore);
607 db_prepare(&q,
608 "SELECT %Q || x FROM sfile"
609 " WHERE x NOT IN (%s)"
610 " ORDER BY 1",
611 g.zLocalRoot, fossil_all_reserved_names(0)
@@ -613,10 +614,14 @@
614 db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
615 }
616 db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)");
617 while( db_step(&q)==SQLITE_ROW ){
618 const char *zName = db_column_text(&q, 0);
619 if( glob_match(pKeep, zName+nRoot) ){
620 fossil_print("WARNING: KEPT file \"%s\" not removed\n", zName+nRoot);
621 continue;
622 }
623 if( !allFileFlag && (!extremeFlag || !glob_match(pIgnore, zName+nRoot)) ){
624 Blob ans;
625 char cReply;
626 char *prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ",
627 zName+nRoot);
@@ -644,12 +649,13 @@
649 if( emptyDirsFlag ){
650 Glob *pEmptyDirs = glob_create(db_get("empty-dirs", 0));
651 Stmt q;
652 Blob root;
653 blob_init(&root, g.zLocalRoot, nRoot - 1);
654 vfile_dir_scan(&root, blob_size(&root), scanFlags,
655 extremeFlag ? 0 : pIgnore,
656 extremeFlag ? 0 : pEmptyDirs);
657 blob_reset(&root);
658 db_prepare(&q,
659 "SELECT %Q || x FROM dscan_temp"
660 " WHERE x NOT IN (%s) AND y = 0"
661 " ORDER BY 1 DESC",
@@ -656,11 +662,11 @@
662 g.zLocalRoot, fossil_all_reserved_names(0)
663 );
664 while( db_step(&q)==SQLITE_ROW ){
665 const char *zName = db_column_text(&q, 0);
666 if( glob_match(pKeep, zName+nRoot) ){
667 fossil_print("WARNING: KEPT directory \"%s\" not removed\n", zName+nRoot);
668 continue;
669 }
670 if( !allDirFlag && (!extremeFlag || !glob_match(pIgnore, zName+nRoot)) ){
671 Blob ans;
672 char cReply;
673
+12 -6
--- src/checkin.c
+++ src/checkin.c
@@ -545,11 +545,11 @@
545545
** Compatibile with "git clean -x".
546546
**
547547
** See also: addremove, extra, status
548548
*/
549549
void clean_cmd(void){
550
- int allFileFlag, allDirFlag, dryRunFlag, extremeFlag, verboseFlag;
550
+ int allFileFlag, allDirFlag, dryRunFlag, verboseFlag, extremeFlag;
551551
int emptyDirsFlag, dirsOnlyFlag;
552552
unsigned scanFlags = 0;
553553
const char *zIgnoreFlag, *zKeepFlag;
554554
Glob *pIgnore, *pKeep;
555555
int nRoot;
@@ -559,11 +559,11 @@
559559
dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
560560
}
561561
extremeFlag = find_option("extreme","x",0)!=0;
562562
allFileFlag = allDirFlag = find_option("force","f",0)!=0;
563563
dirsOnlyFlag = find_option("dirsonly",0,0)!=0;
564
- emptyDirsFlag = dirsOnlyFlag || find_option("emptydirs","d",0)!=0;
564
+ emptyDirsFlag = find_option("emptydirs","d",0)!=0 || dirsOnlyFlag;
565565
if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
566566
if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
567567
if( find_option("allckouts",0,0)!=0 ) scanFlags |= SCAN_NESTED;
568568
zIgnoreFlag = find_option("ignore",0,1);
569569
verboseFlag = find_option("verbose","v",0)!=0;
@@ -600,11 +600,12 @@
600600
pKeep = glob_create(zKeepFlag);
601601
nRoot = (int)strlen(g.zLocalRoot);
602602
if( !dirsOnlyFlag ){
603603
Stmt q;
604604
Blob repo;
605
- locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, extremeFlag ? 0 : pIgnore);
605
+ locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags,
606
+ extremeFlag ? 0 : pIgnore);
606607
db_prepare(&q,
607608
"SELECT %Q || x FROM sfile"
608609
" WHERE x NOT IN (%s)"
609610
" ORDER BY 1",
610611
g.zLocalRoot, fossil_all_reserved_names(0)
@@ -613,10 +614,14 @@
613614
db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
614615
}
615616
db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)");
616617
while( db_step(&q)==SQLITE_ROW ){
617618
const char *zName = db_column_text(&q, 0);
619
+ if( glob_match(pKeep, zName+nRoot) ){
620
+ fossil_print("WARNING: KEPT file \"%s\" not removed\n", zName+nRoot);
621
+ continue;
622
+ }
618623
if( !allFileFlag && (!extremeFlag || !glob_match(pIgnore, zName+nRoot)) ){
619624
Blob ans;
620625
char cReply;
621626
char *prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ",
622627
zName+nRoot);
@@ -644,12 +649,13 @@
644649
if( emptyDirsFlag ){
645650
Glob *pEmptyDirs = glob_create(db_get("empty-dirs", 0));
646651
Stmt q;
647652
Blob root;
648653
blob_init(&root, g.zLocalRoot, nRoot - 1);
649
- vfile_dir_scan(&root, blob_size(&root), scanFlags, pIgnore, pKeep,
650
- pEmptyDirs);
654
+ vfile_dir_scan(&root, blob_size(&root), scanFlags,
655
+ extremeFlag ? 0 : pIgnore,
656
+ extremeFlag ? 0 : pEmptyDirs);
651657
blob_reset(&root);
652658
db_prepare(&q,
653659
"SELECT %Q || x FROM dscan_temp"
654660
" WHERE x NOT IN (%s) AND y = 0"
655661
" ORDER BY 1 DESC",
@@ -656,11 +662,11 @@
656662
g.zLocalRoot, fossil_all_reserved_names(0)
657663
);
658664
while( db_step(&q)==SQLITE_ROW ){
659665
const char *zName = db_column_text(&q, 0);
660666
if( glob_match(pKeep, zName+nRoot) ){
661
- fossil_print("WARNING: KEPT file \"%s\" not removed\n", zName+nRoot);
667
+ fossil_print("WARNING: KEPT directory \"%s\" not removed\n", zName+nRoot);
662668
continue;
663669
}
664670
if( !allDirFlag && (!extremeFlag || !glob_match(pIgnore, zName+nRoot)) ){
665671
Blob ans;
666672
char cReply;
667673
--- src/checkin.c
+++ src/checkin.c
@@ -545,11 +545,11 @@
545 ** Compatibile with "git clean -x".
546 **
547 ** See also: addremove, extra, status
548 */
549 void clean_cmd(void){
550 int allFileFlag, allDirFlag, dryRunFlag, extremeFlag, verboseFlag;
551 int emptyDirsFlag, dirsOnlyFlag;
552 unsigned scanFlags = 0;
553 const char *zIgnoreFlag, *zKeepFlag;
554 Glob *pIgnore, *pKeep;
555 int nRoot;
@@ -559,11 +559,11 @@
559 dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
560 }
561 extremeFlag = find_option("extreme","x",0)!=0;
562 allFileFlag = allDirFlag = find_option("force","f",0)!=0;
563 dirsOnlyFlag = find_option("dirsonly",0,0)!=0;
564 emptyDirsFlag = dirsOnlyFlag || find_option("emptydirs","d",0)!=0;
565 if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
566 if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
567 if( find_option("allckouts",0,0)!=0 ) scanFlags |= SCAN_NESTED;
568 zIgnoreFlag = find_option("ignore",0,1);
569 verboseFlag = find_option("verbose","v",0)!=0;
@@ -600,11 +600,12 @@
600 pKeep = glob_create(zKeepFlag);
601 nRoot = (int)strlen(g.zLocalRoot);
602 if( !dirsOnlyFlag ){
603 Stmt q;
604 Blob repo;
605 locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, extremeFlag ? 0 : pIgnore);
 
606 db_prepare(&q,
607 "SELECT %Q || x FROM sfile"
608 " WHERE x NOT IN (%s)"
609 " ORDER BY 1",
610 g.zLocalRoot, fossil_all_reserved_names(0)
@@ -613,10 +614,14 @@
613 db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
614 }
615 db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)");
616 while( db_step(&q)==SQLITE_ROW ){
617 const char *zName = db_column_text(&q, 0);
 
 
 
 
618 if( !allFileFlag && (!extremeFlag || !glob_match(pIgnore, zName+nRoot)) ){
619 Blob ans;
620 char cReply;
621 char *prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ",
622 zName+nRoot);
@@ -644,12 +649,13 @@
644 if( emptyDirsFlag ){
645 Glob *pEmptyDirs = glob_create(db_get("empty-dirs", 0));
646 Stmt q;
647 Blob root;
648 blob_init(&root, g.zLocalRoot, nRoot - 1);
649 vfile_dir_scan(&root, blob_size(&root), scanFlags, pIgnore, pKeep,
650 pEmptyDirs);
 
651 blob_reset(&root);
652 db_prepare(&q,
653 "SELECT %Q || x FROM dscan_temp"
654 " WHERE x NOT IN (%s) AND y = 0"
655 " ORDER BY 1 DESC",
@@ -656,11 +662,11 @@
656 g.zLocalRoot, fossil_all_reserved_names(0)
657 );
658 while( db_step(&q)==SQLITE_ROW ){
659 const char *zName = db_column_text(&q, 0);
660 if( glob_match(pKeep, zName+nRoot) ){
661 fossil_print("WARNING: KEPT file \"%s\" not removed\n", zName+nRoot);
662 continue;
663 }
664 if( !allDirFlag && (!extremeFlag || !glob_match(pIgnore, zName+nRoot)) ){
665 Blob ans;
666 char cReply;
667
--- src/checkin.c
+++ src/checkin.c
@@ -545,11 +545,11 @@
545 ** Compatibile with "git clean -x".
546 **
547 ** See also: addremove, extra, status
548 */
549 void clean_cmd(void){
550 int allFileFlag, allDirFlag, dryRunFlag, verboseFlag, extremeFlag;
551 int emptyDirsFlag, dirsOnlyFlag;
552 unsigned scanFlags = 0;
553 const char *zIgnoreFlag, *zKeepFlag;
554 Glob *pIgnore, *pKeep;
555 int nRoot;
@@ -559,11 +559,11 @@
559 dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
560 }
561 extremeFlag = find_option("extreme","x",0)!=0;
562 allFileFlag = allDirFlag = find_option("force","f",0)!=0;
563 dirsOnlyFlag = find_option("dirsonly",0,0)!=0;
564 emptyDirsFlag = find_option("emptydirs","d",0)!=0 || dirsOnlyFlag;
565 if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
566 if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
567 if( find_option("allckouts",0,0)!=0 ) scanFlags |= SCAN_NESTED;
568 zIgnoreFlag = find_option("ignore",0,1);
569 verboseFlag = find_option("verbose","v",0)!=0;
@@ -600,11 +600,12 @@
600 pKeep = glob_create(zKeepFlag);
601 nRoot = (int)strlen(g.zLocalRoot);
602 if( !dirsOnlyFlag ){
603 Stmt q;
604 Blob repo;
605 locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags,
606 extremeFlag ? 0 : pIgnore);
607 db_prepare(&q,
608 "SELECT %Q || x FROM sfile"
609 " WHERE x NOT IN (%s)"
610 " ORDER BY 1",
611 g.zLocalRoot, fossil_all_reserved_names(0)
@@ -613,10 +614,14 @@
614 db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
615 }
616 db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)");
617 while( db_step(&q)==SQLITE_ROW ){
618 const char *zName = db_column_text(&q, 0);
619 if( glob_match(pKeep, zName+nRoot) ){
620 fossil_print("WARNING: KEPT file \"%s\" not removed\n", zName+nRoot);
621 continue;
622 }
623 if( !allFileFlag && (!extremeFlag || !glob_match(pIgnore, zName+nRoot)) ){
624 Blob ans;
625 char cReply;
626 char *prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ",
627 zName+nRoot);
@@ -644,12 +649,13 @@
649 if( emptyDirsFlag ){
650 Glob *pEmptyDirs = glob_create(db_get("empty-dirs", 0));
651 Stmt q;
652 Blob root;
653 blob_init(&root, g.zLocalRoot, nRoot - 1);
654 vfile_dir_scan(&root, blob_size(&root), scanFlags,
655 extremeFlag ? 0 : pIgnore,
656 extremeFlag ? 0 : pEmptyDirs);
657 blob_reset(&root);
658 db_prepare(&q,
659 "SELECT %Q || x FROM dscan_temp"
660 " WHERE x NOT IN (%s) AND y = 0"
661 " ORDER BY 1 DESC",
@@ -656,11 +662,11 @@
662 g.zLocalRoot, fossil_all_reserved_names(0)
663 );
664 while( db_step(&q)==SQLITE_ROW ){
665 const char *zName = db_column_text(&q, 0);
666 if( glob_match(pKeep, zName+nRoot) ){
667 fossil_print("WARNING: KEPT directory \"%s\" not removed\n", zName+nRoot);
668 continue;
669 }
670 if( !allDirFlag && (!extremeFlag || !glob_match(pIgnore, zName+nRoot)) ){
671 Blob ans;
672 char cReply;
673
+4 -7
--- src/vfile.c
+++ src/vfile.c
@@ -529,12 +529,11 @@
529529
int vfile_dir_scan(
530530
Blob *pPath, /* Base directory to be scanned */
531531
int nPrefix, /* Number of bytes in base directory name */
532532
unsigned scanFlags, /* Zero or more SCAN_xxx flags */
533533
Glob *pIgnore1, /* Do not add directories that match this GLOB */
534
- Glob *pIgnore2, /* Omit directories matching this GLOB too */
535
- Glob *pIgnore3 /* Omit directories matching this GLOB too */
534
+ Glob *pIgnore2 /* Omit directories matching this GLOB too */
536535
){
537536
int result = 0;
538537
DIR *d;
539538
int origSize;
540539
struct dirent *pEntry;
@@ -543,15 +542,14 @@
543542
static Stmt upd;
544543
static int depth = 0;
545544
void *zNative;
546545
547546
origSize = blob_size(pPath);
548
- if( pIgnore1 || pIgnore2 || pIgnore3 ){
547
+ if( pIgnore1 || pIgnore2 ){
549548
blob_appendf(pPath, "/");
550549
if( glob_match(pIgnore1, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
551550
if( glob_match(pIgnore2, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
552
- if( glob_match(pIgnore3, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
553551
blob_resize(pPath, origSize);
554552
}
555553
if( skipAll ) return result;
556554
557555
if( depth==0 ){
@@ -587,18 +585,17 @@
587585
zOrigPath = mprintf("%s", blob_str(pPath));
588586
zUtf8 = fossil_filename_to_utf8(pEntry->d_name);
589587
blob_appendf(pPath, "/%s", zUtf8);
590588
zPath = blob_str(pPath);
591589
if( glob_match(pIgnore1, &zPath[nPrefix+1]) ||
592
- glob_match(pIgnore2, &zPath[nPrefix+1]) ||
593
- glob_match(pIgnore3, &zPath[nPrefix+1]) ){
590
+ glob_match(pIgnore2, &zPath[nPrefix+1]) ){
594591
/* do nothing */
595592
}else if( file_wd_isdir(zPath)==1 ){
596593
if( (scanFlags & SCAN_NESTED) || !vfile_top_of_checkout(zPath) ){
597594
char *zSavePath = mprintf("%s", zPath);
598595
int count = vfile_dir_scan(pPath, nPrefix, scanFlags, pIgnore1,
599
- pIgnore2, pIgnore3);
596
+ pIgnore2);
600597
db_bind_text(&ins, ":file", &zSavePath[nPrefix+1]);
601598
db_bind_int(&ins, ":count", count);
602599
db_step(&ins);
603600
db_reset(&ins);
604601
fossil_free(zSavePath);
605602
--- src/vfile.c
+++ src/vfile.c
@@ -529,12 +529,11 @@
529 int vfile_dir_scan(
530 Blob *pPath, /* Base directory to be scanned */
531 int nPrefix, /* Number of bytes in base directory name */
532 unsigned scanFlags, /* Zero or more SCAN_xxx flags */
533 Glob *pIgnore1, /* Do not add directories that match this GLOB */
534 Glob *pIgnore2, /* Omit directories matching this GLOB too */
535 Glob *pIgnore3 /* Omit directories matching this GLOB too */
536 ){
537 int result = 0;
538 DIR *d;
539 int origSize;
540 struct dirent *pEntry;
@@ -543,15 +542,14 @@
543 static Stmt upd;
544 static int depth = 0;
545 void *zNative;
546
547 origSize = blob_size(pPath);
548 if( pIgnore1 || pIgnore2 || pIgnore3 ){
549 blob_appendf(pPath, "/");
550 if( glob_match(pIgnore1, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
551 if( glob_match(pIgnore2, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
552 if( glob_match(pIgnore3, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
553 blob_resize(pPath, origSize);
554 }
555 if( skipAll ) return result;
556
557 if( depth==0 ){
@@ -587,18 +585,17 @@
587 zOrigPath = mprintf("%s", blob_str(pPath));
588 zUtf8 = fossil_filename_to_utf8(pEntry->d_name);
589 blob_appendf(pPath, "/%s", zUtf8);
590 zPath = blob_str(pPath);
591 if( glob_match(pIgnore1, &zPath[nPrefix+1]) ||
592 glob_match(pIgnore2, &zPath[nPrefix+1]) ||
593 glob_match(pIgnore3, &zPath[nPrefix+1]) ){
594 /* do nothing */
595 }else if( file_wd_isdir(zPath)==1 ){
596 if( (scanFlags & SCAN_NESTED) || !vfile_top_of_checkout(zPath) ){
597 char *zSavePath = mprintf("%s", zPath);
598 int count = vfile_dir_scan(pPath, nPrefix, scanFlags, pIgnore1,
599 pIgnore2, pIgnore3);
600 db_bind_text(&ins, ":file", &zSavePath[nPrefix+1]);
601 db_bind_int(&ins, ":count", count);
602 db_step(&ins);
603 db_reset(&ins);
604 fossil_free(zSavePath);
605
--- src/vfile.c
+++ src/vfile.c
@@ -529,12 +529,11 @@
529 int vfile_dir_scan(
530 Blob *pPath, /* Base directory to be scanned */
531 int nPrefix, /* Number of bytes in base directory name */
532 unsigned scanFlags, /* Zero or more SCAN_xxx flags */
533 Glob *pIgnore1, /* Do not add directories that match this GLOB */
534 Glob *pIgnore2 /* Omit directories matching this GLOB too */
 
535 ){
536 int result = 0;
537 DIR *d;
538 int origSize;
539 struct dirent *pEntry;
@@ -543,15 +542,14 @@
542 static Stmt upd;
543 static int depth = 0;
544 void *zNative;
545
546 origSize = blob_size(pPath);
547 if( pIgnore1 || pIgnore2 ){
548 blob_appendf(pPath, "/");
549 if( glob_match(pIgnore1, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
550 if( glob_match(pIgnore2, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
 
551 blob_resize(pPath, origSize);
552 }
553 if( skipAll ) return result;
554
555 if( depth==0 ){
@@ -587,18 +585,17 @@
585 zOrigPath = mprintf("%s", blob_str(pPath));
586 zUtf8 = fossil_filename_to_utf8(pEntry->d_name);
587 blob_appendf(pPath, "/%s", zUtf8);
588 zPath = blob_str(pPath);
589 if( glob_match(pIgnore1, &zPath[nPrefix+1]) ||
590 glob_match(pIgnore2, &zPath[nPrefix+1]) ){
 
591 /* do nothing */
592 }else if( file_wd_isdir(zPath)==1 ){
593 if( (scanFlags & SCAN_NESTED) || !vfile_top_of_checkout(zPath) ){
594 char *zSavePath = mprintf("%s", zPath);
595 int count = vfile_dir_scan(pPath, nPrefix, scanFlags, pIgnore1,
596 pIgnore2);
597 db_bind_text(&ins, ":file", &zSavePath[nPrefix+1]);
598 db_bind_int(&ins, ":count", count);
599 db_step(&ins);
600 db_reset(&ins);
601 fossil_free(zSavePath);
602
+4 -7
--- src/vfile.c
+++ src/vfile.c
@@ -529,12 +529,11 @@
529529
int vfile_dir_scan(
530530
Blob *pPath, /* Base directory to be scanned */
531531
int nPrefix, /* Number of bytes in base directory name */
532532
unsigned scanFlags, /* Zero or more SCAN_xxx flags */
533533
Glob *pIgnore1, /* Do not add directories that match this GLOB */
534
- Glob *pIgnore2, /* Omit directories matching this GLOB too */
535
- Glob *pIgnore3 /* Omit directories matching this GLOB too */
534
+ Glob *pIgnore2 /* Omit directories matching this GLOB too */
536535
){
537536
int result = 0;
538537
DIR *d;
539538
int origSize;
540539
struct dirent *pEntry;
@@ -543,15 +542,14 @@
543542
static Stmt upd;
544543
static int depth = 0;
545544
void *zNative;
546545
547546
origSize = blob_size(pPath);
548
- if( pIgnore1 || pIgnore2 || pIgnore3 ){
547
+ if( pIgnore1 || pIgnore2 ){
549548
blob_appendf(pPath, "/");
550549
if( glob_match(pIgnore1, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
551550
if( glob_match(pIgnore2, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
552
- if( glob_match(pIgnore3, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
553551
blob_resize(pPath, origSize);
554552
}
555553
if( skipAll ) return result;
556554
557555
if( depth==0 ){
@@ -587,18 +585,17 @@
587585
zOrigPath = mprintf("%s", blob_str(pPath));
588586
zUtf8 = fossil_filename_to_utf8(pEntry->d_name);
589587
blob_appendf(pPath, "/%s", zUtf8);
590588
zPath = blob_str(pPath);
591589
if( glob_match(pIgnore1, &zPath[nPrefix+1]) ||
592
- glob_match(pIgnore2, &zPath[nPrefix+1]) ||
593
- glob_match(pIgnore3, &zPath[nPrefix+1]) ){
590
+ glob_match(pIgnore2, &zPath[nPrefix+1]) ){
594591
/* do nothing */
595592
}else if( file_wd_isdir(zPath)==1 ){
596593
if( (scanFlags & SCAN_NESTED) || !vfile_top_of_checkout(zPath) ){
597594
char *zSavePath = mprintf("%s", zPath);
598595
int count = vfile_dir_scan(pPath, nPrefix, scanFlags, pIgnore1,
599
- pIgnore2, pIgnore3);
596
+ pIgnore2);
600597
db_bind_text(&ins, ":file", &zSavePath[nPrefix+1]);
601598
db_bind_int(&ins, ":count", count);
602599
db_step(&ins);
603600
db_reset(&ins);
604601
fossil_free(zSavePath);
605602
--- src/vfile.c
+++ src/vfile.c
@@ -529,12 +529,11 @@
529 int vfile_dir_scan(
530 Blob *pPath, /* Base directory to be scanned */
531 int nPrefix, /* Number of bytes in base directory name */
532 unsigned scanFlags, /* Zero or more SCAN_xxx flags */
533 Glob *pIgnore1, /* Do not add directories that match this GLOB */
534 Glob *pIgnore2, /* Omit directories matching this GLOB too */
535 Glob *pIgnore3 /* Omit directories matching this GLOB too */
536 ){
537 int result = 0;
538 DIR *d;
539 int origSize;
540 struct dirent *pEntry;
@@ -543,15 +542,14 @@
543 static Stmt upd;
544 static int depth = 0;
545 void *zNative;
546
547 origSize = blob_size(pPath);
548 if( pIgnore1 || pIgnore2 || pIgnore3 ){
549 blob_appendf(pPath, "/");
550 if( glob_match(pIgnore1, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
551 if( glob_match(pIgnore2, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
552 if( glob_match(pIgnore3, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
553 blob_resize(pPath, origSize);
554 }
555 if( skipAll ) return result;
556
557 if( depth==0 ){
@@ -587,18 +585,17 @@
587 zOrigPath = mprintf("%s", blob_str(pPath));
588 zUtf8 = fossil_filename_to_utf8(pEntry->d_name);
589 blob_appendf(pPath, "/%s", zUtf8);
590 zPath = blob_str(pPath);
591 if( glob_match(pIgnore1, &zPath[nPrefix+1]) ||
592 glob_match(pIgnore2, &zPath[nPrefix+1]) ||
593 glob_match(pIgnore3, &zPath[nPrefix+1]) ){
594 /* do nothing */
595 }else if( file_wd_isdir(zPath)==1 ){
596 if( (scanFlags & SCAN_NESTED) || !vfile_top_of_checkout(zPath) ){
597 char *zSavePath = mprintf("%s", zPath);
598 int count = vfile_dir_scan(pPath, nPrefix, scanFlags, pIgnore1,
599 pIgnore2, pIgnore3);
600 db_bind_text(&ins, ":file", &zSavePath[nPrefix+1]);
601 db_bind_int(&ins, ":count", count);
602 db_step(&ins);
603 db_reset(&ins);
604 fossil_free(zSavePath);
605
--- src/vfile.c
+++ src/vfile.c
@@ -529,12 +529,11 @@
529 int vfile_dir_scan(
530 Blob *pPath, /* Base directory to be scanned */
531 int nPrefix, /* Number of bytes in base directory name */
532 unsigned scanFlags, /* Zero or more SCAN_xxx flags */
533 Glob *pIgnore1, /* Do not add directories that match this GLOB */
534 Glob *pIgnore2 /* Omit directories matching this GLOB too */
 
535 ){
536 int result = 0;
537 DIR *d;
538 int origSize;
539 struct dirent *pEntry;
@@ -543,15 +542,14 @@
542 static Stmt upd;
543 static int depth = 0;
544 void *zNative;
545
546 origSize = blob_size(pPath);
547 if( pIgnore1 || pIgnore2 ){
548 blob_appendf(pPath, "/");
549 if( glob_match(pIgnore1, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
550 if( glob_match(pIgnore2, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
 
551 blob_resize(pPath, origSize);
552 }
553 if( skipAll ) return result;
554
555 if( depth==0 ){
@@ -587,18 +585,17 @@
585 zOrigPath = mprintf("%s", blob_str(pPath));
586 zUtf8 = fossil_filename_to_utf8(pEntry->d_name);
587 blob_appendf(pPath, "/%s", zUtf8);
588 zPath = blob_str(pPath);
589 if( glob_match(pIgnore1, &zPath[nPrefix+1]) ||
590 glob_match(pIgnore2, &zPath[nPrefix+1]) ){
 
591 /* do nothing */
592 }else if( file_wd_isdir(zPath)==1 ){
593 if( (scanFlags & SCAN_NESTED) || !vfile_top_of_checkout(zPath) ){
594 char *zSavePath = mprintf("%s", zPath);
595 int count = vfile_dir_scan(pPath, nPrefix, scanFlags, pIgnore1,
596 pIgnore2);
597 db_bind_text(&ins, ":file", &zSavePath[nPrefix+1]);
598 db_bind_int(&ins, ":count", count);
599 db_step(&ins);
600 db_reset(&ins);
601 fossil_free(zSavePath);
602

Keyboard Shortcuts

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