Fossil SCM

Remove some dead code (matchKeep is always false) and improve efficiency (only do glob_match() when extremeFlags is set, otherwise we already know it will be false)

jan.nijtmans 2014-03-23 16:13 cleanX
Commit b0b723fbff39289ee6aa4e2c066f2e181a329086
1 file changed +9 -11
+9 -11
--- src/checkin.c
+++ src/checkin.c
@@ -630,16 +630,15 @@
630630
while( db_step(&q)==SQLITE_ROW ){
631631
const char *zName = db_column_text(&q, 0);
632632
if( !allFileFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){
633633
Blob ans;
634634
char cReply;
635
- int matchIgnore = glob_match(pIgnore, zName+nRoot);
636
- int matchKeep = glob_match(pKeep, zName+nRoot);
635
+ int matchIgnore = extremeFlag && glob_match(pIgnore, zName+nRoot);
637636
char *prompt = mprintf("%sRemove %s file \"%s\" (a=all/y/N)? ",
638
- (matchIgnore || matchKeep) ? "WARNING: " : "",
639
- matchKeep ? "\"KEPT\"" : (matchIgnore ?
640
- "\"IGNORED\"" : "unmanaged"), zName+nRoot);
637
+ matchIgnore ? "WARNING: " : "",
638
+ matchIgnore ? "\"IGNORED\"" : "unmanaged",
639
+ zName+nRoot);
641640
prompt_user(prompt, &ans);
642641
cReply = blob_str(&ans)[0];
643642
if( cReply=='a' || cReply=='A' ){
644643
allFileFlag = 1;
645644
}else if( cReply!='y' && cReply!='Y' ){
@@ -676,19 +675,18 @@
676675
while( db_step(&q)==SQLITE_ROW ){
677676
const char *zName = db_column_text(&q, 0);
678677
if( !allDirFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){
679678
Blob ans;
680679
char cReply;
681
- int matchIgnore = glob_match(pIgnore, zName+nRoot);
682
- int matchKeep = glob_match(pKeep, zName+nRoot);
683
- int matchEmpty = glob_match(pEmptyDirs, zName+nRoot);
680
+ int matchIgnore = extremeFlag && glob_match(pIgnore, zName+nRoot);
681
+ int matchEmpty = extremeFlag && glob_match(pEmptyDirs, zName+nRoot);
684682
char *prompt = mprintf("%sRemove %s empty directory \"%s\" "
685683
"(a=all/y/N)? ",
686
- (matchEmpty || matchIgnore || matchKeep) ?
684
+ (matchEmpty || matchIgnore) ?
687685
"WARNING: " : "", matchEmpty ? "\"RESERVED\"" :
688
- matchKeep ? "\"KEPT\"" : (matchIgnore ?
689
- "\"IGNORED\"" : "unmanaged"), zName+nRoot);
686
+ matchIgnore ? "\"IGNORED\"" : "unmanaged",
687
+ zName+nRoot);
690688
prompt_user(prompt, &ans);
691689
cReply = blob_str(&ans)[0];
692690
if( cReply=='a' || cReply=='A' ){
693691
allDirFlag = 1;
694692
}else if( cReply!='y' && cReply!='Y' ){
695693
--- src/checkin.c
+++ src/checkin.c
@@ -630,16 +630,15 @@
630 while( db_step(&q)==SQLITE_ROW ){
631 const char *zName = db_column_text(&q, 0);
632 if( !allFileFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){
633 Blob ans;
634 char cReply;
635 int matchIgnore = glob_match(pIgnore, zName+nRoot);
636 int matchKeep = glob_match(pKeep, zName+nRoot);
637 char *prompt = mprintf("%sRemove %s file \"%s\" (a=all/y/N)? ",
638 (matchIgnore || matchKeep) ? "WARNING: " : "",
639 matchKeep ? "\"KEPT\"" : (matchIgnore ?
640 "\"IGNORED\"" : "unmanaged"), zName+nRoot);
641 prompt_user(prompt, &ans);
642 cReply = blob_str(&ans)[0];
643 if( cReply=='a' || cReply=='A' ){
644 allFileFlag = 1;
645 }else if( cReply!='y' && cReply!='Y' ){
@@ -676,19 +675,18 @@
676 while( db_step(&q)==SQLITE_ROW ){
677 const char *zName = db_column_text(&q, 0);
678 if( !allDirFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){
679 Blob ans;
680 char cReply;
681 int matchIgnore = glob_match(pIgnore, zName+nRoot);
682 int matchKeep = glob_match(pKeep, zName+nRoot);
683 int matchEmpty = glob_match(pEmptyDirs, zName+nRoot);
684 char *prompt = mprintf("%sRemove %s empty directory \"%s\" "
685 "(a=all/y/N)? ",
686 (matchEmpty || matchIgnore || matchKeep) ?
687 "WARNING: " : "", matchEmpty ? "\"RESERVED\"" :
688 matchKeep ? "\"KEPT\"" : (matchIgnore ?
689 "\"IGNORED\"" : "unmanaged"), zName+nRoot);
690 prompt_user(prompt, &ans);
691 cReply = blob_str(&ans)[0];
692 if( cReply=='a' || cReply=='A' ){
693 allDirFlag = 1;
694 }else if( cReply!='y' && cReply!='Y' ){
695
--- src/checkin.c
+++ src/checkin.c
@@ -630,16 +630,15 @@
630 while( db_step(&q)==SQLITE_ROW ){
631 const char *zName = db_column_text(&q, 0);
632 if( !allFileFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){
633 Blob ans;
634 char cReply;
635 int matchIgnore = extremeFlag && glob_match(pIgnore, zName+nRoot);
 
636 char *prompt = mprintf("%sRemove %s file \"%s\" (a=all/y/N)? ",
637 matchIgnore ? "WARNING: " : "",
638 matchIgnore ? "\"IGNORED\"" : "unmanaged",
639 zName+nRoot);
640 prompt_user(prompt, &ans);
641 cReply = blob_str(&ans)[0];
642 if( cReply=='a' || cReply=='A' ){
643 allFileFlag = 1;
644 }else if( cReply!='y' && cReply!='Y' ){
@@ -676,19 +675,18 @@
675 while( db_step(&q)==SQLITE_ROW ){
676 const char *zName = db_column_text(&q, 0);
677 if( !allDirFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){
678 Blob ans;
679 char cReply;
680 int matchIgnore = extremeFlag && glob_match(pIgnore, zName+nRoot);
681 int matchEmpty = extremeFlag && glob_match(pEmptyDirs, zName+nRoot);
 
682 char *prompt = mprintf("%sRemove %s empty directory \"%s\" "
683 "(a=all/y/N)? ",
684 (matchEmpty || matchIgnore) ?
685 "WARNING: " : "", matchEmpty ? "\"RESERVED\"" :
686 matchIgnore ? "\"IGNORED\"" : "unmanaged",
687 zName+nRoot);
688 prompt_user(prompt, &ans);
689 cReply = blob_str(&ans)[0];
690 if( cReply=='a' || cReply=='A' ){
691 allDirFlag = 1;
692 }else if( cReply!='y' && cReply!='Y' ){
693

Keyboard Shortcuts

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