Fossil SCM

When searching embedded docs, search the configured 'doc-branch' branch instead of hard-wiring the search for trunk. Problem reported in [forum:520d420d04e482b2|forum post 520d420d04]. Previously it was always searching trunk but generating links to the doc-branch.

stephan 2024-10-16 00:18 trunk merge
Commit 163f2f599e9f9178bef0e2fd5a28023b3c12a3e0303d0574e667797855208d14
3 files changed +2 -2 +2 -2 +5 -3
+2 -2
--- src/glob.c
+++ src/glob.c
@@ -34,12 +34,12 @@
3434
** Commas and whitespace are considered to be element delimters. Each
3535
** element of the GLOB list may optionally be enclosed in either '...' or
3636
** "...". This allows commas and/or whitespace to be used in the elements
3737
** themselves.
3838
**
39
-** This routine makes no effort to free the memory space it uses, which
40
-** currently consists of a blob object and its contents.
39
+** The returned string is owned by the caller, who must fossil_free()
40
+** it.
4141
*/
4242
char *glob_expr(const char *zVal, const char *zGlobList){
4343
Blob expr;
4444
const char *zSep = "(";
4545
int nTerm = 0;
4646
--- src/glob.c
+++ src/glob.c
@@ -34,12 +34,12 @@
34 ** Commas and whitespace are considered to be element delimters. Each
35 ** element of the GLOB list may optionally be enclosed in either '...' or
36 ** "...". This allows commas and/or whitespace to be used in the elements
37 ** themselves.
38 **
39 ** This routine makes no effort to free the memory space it uses, which
40 ** currently consists of a blob object and its contents.
41 */
42 char *glob_expr(const char *zVal, const char *zGlobList){
43 Blob expr;
44 const char *zSep = "(";
45 int nTerm = 0;
46
--- src/glob.c
+++ src/glob.c
@@ -34,12 +34,12 @@
34 ** Commas and whitespace are considered to be element delimters. Each
35 ** element of the GLOB list may optionally be enclosed in either '...' or
36 ** "...". This allows commas and/or whitespace to be used in the elements
37 ** themselves.
38 **
39 ** The returned string is owned by the caller, who must fossil_free()
40 ** it.
41 */
42 char *glob_expr(const char *zVal, const char *zGlobList){
43 Blob expr;
44 const char *zSep = "(";
45 int nTerm = 0;
46
+2 -2
--- src/glob.c
+++ src/glob.c
@@ -34,12 +34,12 @@
3434
** Commas and whitespace are considered to be element delimters. Each
3535
** element of the GLOB list may optionally be enclosed in either '...' or
3636
** "...". This allows commas and/or whitespace to be used in the elements
3737
** themselves.
3838
**
39
-** This routine makes no effort to free the memory space it uses, which
40
-** currently consists of a blob object and its contents.
39
+** The returned string is owned by the caller, who must fossil_free()
40
+** it.
4141
*/
4242
char *glob_expr(const char *zVal, const char *zGlobList){
4343
Blob expr;
4444
const char *zSep = "(";
4545
int nTerm = 0;
4646
--- src/glob.c
+++ src/glob.c
@@ -34,12 +34,12 @@
34 ** Commas and whitespace are considered to be element delimters. Each
35 ** element of the GLOB list may optionally be enclosed in either '...' or
36 ** "...". This allows commas and/or whitespace to be used in the elements
37 ** themselves.
38 **
39 ** This routine makes no effort to free the memory space it uses, which
40 ** currently consists of a blob object and its contents.
41 */
42 char *glob_expr(const char *zVal, const char *zGlobList){
43 Blob expr;
44 const char *zSep = "(";
45 int nTerm = 0;
46
--- src/glob.c
+++ src/glob.c
@@ -34,12 +34,12 @@
34 ** Commas and whitespace are considered to be element delimters. Each
35 ** element of the GLOB list may optionally be enclosed in either '...' or
36 ** "...". This allows commas and/or whitespace to be used in the elements
37 ** themselves.
38 **
39 ** The returned string is owned by the caller, who must fossil_free()
40 ** it.
41 */
42 char *glob_expr(const char *zVal, const char *zGlobList){
43 Blob expr;
44 const char *zSep = "(";
45 int nTerm = 0;
46
+5 -3
--- src/search.c
+++ src/search.c
@@ -804,21 +804,23 @@
804804
" SELECT printf('Document: %%s',title('d',blob.rid,foci.filename)),"
805805
" printf('/doc/%T/%%s',foci.filename),"
806806
" search_score(),"
807807
" 'd'||blob.rid,"
808808
" (SELECT datetime(event.mtime) FROM event"
809
- " WHERE objid=symbolic_name_to_rid('trunk')),"
809
+ " WHERE objid=symbolic_name_to_rid(%Q)),"
810810
" search_snippet()"
811811
" FROM foci CROSS JOIN blob"
812
- " WHERE checkinID=symbolic_name_to_rid('trunk')"
812
+ " WHERE checkinID=symbolic_name_to_rid(%Q)"
813813
" AND blob.uuid=foci.uuid"
814814
" AND search_match(title('d',blob.rid,foci.filename),"
815815
" body('d',blob.rid,foci.filename))"
816816
" AND %z",
817
- zDocBr, glob_expr("foci.filename", zDocGlob)
817
+ zDocBr, zDocBr, zDocBr, glob_expr("foci.filename", zDocGlob)
818818
);
819819
}
820
+ fossil_free(zDocGlob);
821
+ fossil_free(zDocBr);
820822
}
821823
if( (srchFlags & SRCH_WIKI)!=0 ){
822824
db_multi_exec(
823825
"WITH wiki(name,rid,mtime) AS ("
824826
" SELECT substr(tagname,6), tagxref.rid, max(tagxref.mtime)"
825827
--- src/search.c
+++ src/search.c
@@ -804,21 +804,23 @@
804 " SELECT printf('Document: %%s',title('d',blob.rid,foci.filename)),"
805 " printf('/doc/%T/%%s',foci.filename),"
806 " search_score(),"
807 " 'd'||blob.rid,"
808 " (SELECT datetime(event.mtime) FROM event"
809 " WHERE objid=symbolic_name_to_rid('trunk')),"
810 " search_snippet()"
811 " FROM foci CROSS JOIN blob"
812 " WHERE checkinID=symbolic_name_to_rid('trunk')"
813 " AND blob.uuid=foci.uuid"
814 " AND search_match(title('d',blob.rid,foci.filename),"
815 " body('d',blob.rid,foci.filename))"
816 " AND %z",
817 zDocBr, glob_expr("foci.filename", zDocGlob)
818 );
819 }
 
 
820 }
821 if( (srchFlags & SRCH_WIKI)!=0 ){
822 db_multi_exec(
823 "WITH wiki(name,rid,mtime) AS ("
824 " SELECT substr(tagname,6), tagxref.rid, max(tagxref.mtime)"
825
--- src/search.c
+++ src/search.c
@@ -804,21 +804,23 @@
804 " SELECT printf('Document: %%s',title('d',blob.rid,foci.filename)),"
805 " printf('/doc/%T/%%s',foci.filename),"
806 " search_score(),"
807 " 'd'||blob.rid,"
808 " (SELECT datetime(event.mtime) FROM event"
809 " WHERE objid=symbolic_name_to_rid(%Q)),"
810 " search_snippet()"
811 " FROM foci CROSS JOIN blob"
812 " WHERE checkinID=symbolic_name_to_rid(%Q)"
813 " AND blob.uuid=foci.uuid"
814 " AND search_match(title('d',blob.rid,foci.filename),"
815 " body('d',blob.rid,foci.filename))"
816 " AND %z",
817 zDocBr, zDocBr, zDocBr, glob_expr("foci.filename", zDocGlob)
818 );
819 }
820 fossil_free(zDocGlob);
821 fossil_free(zDocBr);
822 }
823 if( (srchFlags & SRCH_WIKI)!=0 ){
824 db_multi_exec(
825 "WITH wiki(name,rid,mtime) AS ("
826 " SELECT substr(tagname,6), tagxref.rid, max(tagxref.mtime)"
827

Keyboard Shortcuts

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