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.
Commit
163f2f599e9f9178bef0e2fd5a28023b3c12a3e0303d0574e667797855208d14
Parent
2ff87d4e0f78641…
3 files changed
+2
-2
+2
-2
+5
-3
+2
-2
| --- src/glob.c | ||
| +++ src/glob.c | ||
| @@ -34,12 +34,12 @@ | ||
| 34 | 34 | ** Commas and whitespace are considered to be element delimters. Each |
| 35 | 35 | ** element of the GLOB list may optionally be enclosed in either '...' or |
| 36 | 36 | ** "...". This allows commas and/or whitespace to be used in the elements |
| 37 | 37 | ** themselves. |
| 38 | 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. | |
| 39 | +** The returned string is owned by the caller, who must fossil_free() | |
| 40 | +** it. | |
| 41 | 41 | */ |
| 42 | 42 | char *glob_expr(const char *zVal, const char *zGlobList){ |
| 43 | 43 | Blob expr; |
| 44 | 44 | const char *zSep = "("; |
| 45 | 45 | int nTerm = 0; |
| 46 | 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 | ** 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 @@ | ||
| 34 | 34 | ** Commas and whitespace are considered to be element delimters. Each |
| 35 | 35 | ** element of the GLOB list may optionally be enclosed in either '...' or |
| 36 | 36 | ** "...". This allows commas and/or whitespace to be used in the elements |
| 37 | 37 | ** themselves. |
| 38 | 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. | |
| 39 | +** The returned string is owned by the caller, who must fossil_free() | |
| 40 | +** it. | |
| 41 | 41 | */ |
| 42 | 42 | char *glob_expr(const char *zVal, const char *zGlobList){ |
| 43 | 43 | Blob expr; |
| 44 | 44 | const char *zSep = "("; |
| 45 | 45 | int nTerm = 0; |
| 46 | 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 | ** 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 @@ | ||
| 804 | 804 | " SELECT printf('Document: %%s',title('d',blob.rid,foci.filename))," |
| 805 | 805 | " printf('/doc/%T/%%s',foci.filename)," |
| 806 | 806 | " search_score()," |
| 807 | 807 | " 'd'||blob.rid," |
| 808 | 808 | " (SELECT datetime(event.mtime) FROM event" |
| 809 | - " WHERE objid=symbolic_name_to_rid('trunk'))," | |
| 809 | + " WHERE objid=symbolic_name_to_rid(%Q))," | |
| 810 | 810 | " search_snippet()" |
| 811 | 811 | " FROM foci CROSS JOIN blob" |
| 812 | - " WHERE checkinID=symbolic_name_to_rid('trunk')" | |
| 812 | + " WHERE checkinID=symbolic_name_to_rid(%Q)" | |
| 813 | 813 | " AND blob.uuid=foci.uuid" |
| 814 | 814 | " AND search_match(title('d',blob.rid,foci.filename)," |
| 815 | 815 | " body('d',blob.rid,foci.filename))" |
| 816 | 816 | " AND %z", |
| 817 | - zDocBr, glob_expr("foci.filename", zDocGlob) | |
| 817 | + zDocBr, zDocBr, zDocBr, glob_expr("foci.filename", zDocGlob) | |
| 818 | 818 | ); |
| 819 | 819 | } |
| 820 | + fossil_free(zDocGlob); | |
| 821 | + fossil_free(zDocBr); | |
| 820 | 822 | } |
| 821 | 823 | if( (srchFlags & SRCH_WIKI)!=0 ){ |
| 822 | 824 | db_multi_exec( |
| 823 | 825 | "WITH wiki(name,rid,mtime) AS (" |
| 824 | 826 | " SELECT substr(tagname,6), tagxref.rid, max(tagxref.mtime)" |
| 825 | 827 |
| --- 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 |