Fossil SCM

Improved error message from "fossil search" when attempt to search a document type for which search is disabled.

drh 2025-02-26 16:00 help-search
Commit 78263fe1890940b349a5a47933d38b7fb8c82de7b27a8749b190d925dbd79298
1 file changed +10 -2
+10 -2
--- src/search.c
+++ src/search.c
@@ -740,13 +740,21 @@
740740
db_find_and_open_repository(0, 0);
741741
verify_all_options();
742742
if( g.argc<3 ) return;
743743
login_set_capabilities("s", 0);
744744
if( search_restrict(srchFlags, 1)==0 ){
745
+ const char *zC1 = 0, *zPlural = "s";
746
+ if( srchFlags & SRCH_TECHNOTE ){ zC1 = "technote"; }
747
+ if( srchFlags & SRCH_TKT ){ zC1 = "ticket"; }
748
+ if( srchFlags & SRCH_FORUM ){ zC1 = "forum"; zPlural = ""; }
749
+ if( srchFlags & SRCH_DOC ){ zC1 = "document"; }
750
+ if( srchFlags & SRCH_WIKI ){ zC1 = "wiki"; zPlural = ""; }
751
+ if( srchFlags & SRCH_CKIN ){ zC1 = "check-in"; }
745752
fossil_print(
746
- "Search is disabled on this repository.\n"
747
- "Use the \"fossil fts-config\" command to enable.\n"
753
+ "Search of %s%s is disabled on this repository.\n"
754
+ "Enable using \"fossil fts-config enable %s\".\n",
755
+ zC1, zPlural, zC1
748756
);
749757
return;
750758
}
751759
752760
blob_init(&pattern, g.argv[2], -1);
753761
--- src/search.c
+++ src/search.c
@@ -740,13 +740,21 @@
740 db_find_and_open_repository(0, 0);
741 verify_all_options();
742 if( g.argc<3 ) return;
743 login_set_capabilities("s", 0);
744 if( search_restrict(srchFlags, 1)==0 ){
 
 
 
 
 
 
 
745 fossil_print(
746 "Search is disabled on this repository.\n"
747 "Use the \"fossil fts-config\" command to enable.\n"
 
748 );
749 return;
750 }
751
752 blob_init(&pattern, g.argv[2], -1);
753
--- src/search.c
+++ src/search.c
@@ -740,13 +740,21 @@
740 db_find_and_open_repository(0, 0);
741 verify_all_options();
742 if( g.argc<3 ) return;
743 login_set_capabilities("s", 0);
744 if( search_restrict(srchFlags, 1)==0 ){
745 const char *zC1 = 0, *zPlural = "s";
746 if( srchFlags & SRCH_TECHNOTE ){ zC1 = "technote"; }
747 if( srchFlags & SRCH_TKT ){ zC1 = "ticket"; }
748 if( srchFlags & SRCH_FORUM ){ zC1 = "forum"; zPlural = ""; }
749 if( srchFlags & SRCH_DOC ){ zC1 = "document"; }
750 if( srchFlags & SRCH_WIKI ){ zC1 = "wiki"; zPlural = ""; }
751 if( srchFlags & SRCH_CKIN ){ zC1 = "check-in"; }
752 fossil_print(
753 "Search of %s%s is disabled on this repository.\n"
754 "Enable using \"fossil fts-config enable %s\".\n",
755 zC1, zPlural, zC1
756 );
757 return;
758 }
759
760 blob_init(&pattern, g.argv[2], -1);
761

Keyboard Shortcuts

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