Fossil SCM
Improved error message from "fossil search" when attempt to search a document type for which search is disabled.
Commit
78263fe1890940b349a5a47933d38b7fb8c82de7b27a8749b190d925dbd79298
Parent
7ea128dd518b03f…
1 file changed
+10
-2
+10
-2
| --- src/search.c | ||
| +++ src/search.c | ||
| @@ -740,13 +740,21 @@ | ||
| 740 | 740 | db_find_and_open_repository(0, 0); |
| 741 | 741 | verify_all_options(); |
| 742 | 742 | if( g.argc<3 ) return; |
| 743 | 743 | login_set_capabilities("s", 0); |
| 744 | 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"; } | |
| 745 | 752 | 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 | |
| 748 | 756 | ); |
| 749 | 757 | return; |
| 750 | 758 | } |
| 751 | 759 | |
| 752 | 760 | blob_init(&pattern, g.argv[2], -1); |
| 753 | 761 |
| --- 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 |