Fossil SCM

In directory/repolist mode, do not link to X/Y.fossil if X.fossil exists, to avoid the X/Y/... URI ambiguity. Reported in [forum:f50f647c97c72fc1 | forum post f50f647c97c72fc1].

stephan 2022-06-22 11:11 trunk
Commit 9584806cc6a8c005f93dcb4498caa9a08465c5c69d185798feaaddabfe3ade1a
1 file changed +20
--- src/repolist.c
+++ src/repolist.c
@@ -230,10 +230,30 @@
230230
blob_append_sql(&html, "%h (hidden)", zName);
231231
} else if( allRepo && sqlite3_strglob("[a-zA-Z]:/?*", zName)!=0 ){
232232
blob_append_sql(&html,
233233
"<a href='%R/%T/home' target='_blank'>/%h</a>\n",
234234
zUrl, zName);
235
+ }else if( sqlite3_strglob("*/*.fossil", zName)==0 ){
236
+ /* As described in
237
+ ** https://fossil-scm.org/forum/info/f50f647c97c72fc1: if
238
+ ** foo.fossil and foo/bar.fossil both exist and we create a
239
+ ** link to foo/bar/... then the URI dispatcher will instead
240
+ ** see that as a link to foo.fossil. In such cases, do not
241
+ ** emit a link to foo/bar.fossil. */
242
+ char * zDirPart = file_dirname(zName);
243
+ if( db_exists("SELECT 1 FROM sfile "
244
+ "WHERE pathname=(%Q || '.fossil') COLLATE nocase",
245
+ zDirPart) ){
246
+ blob_append_sql(&html,
247
+ "<s>%h</s> (directory/repo name collision)\n",
248
+ zName);
249
+ }else{
250
+ blob_append_sql(&html,
251
+ "<a href='%R/%T/home' target='_blank'>%h</a>\n",
252
+ zUrl, zName);
253
+ }
254
+ fossil_free(zDirPart);
235255
}else{
236256
blob_append_sql(&html,
237257
"<a href='%R/%T/home' target='_blank'>%h</a>\n",
238258
zUrl, zName);
239259
}
240260
--- src/repolist.c
+++ src/repolist.c
@@ -230,10 +230,30 @@
230 blob_append_sql(&html, "%h (hidden)", zName);
231 } else if( allRepo && sqlite3_strglob("[a-zA-Z]:/?*", zName)!=0 ){
232 blob_append_sql(&html,
233 "<a href='%R/%T/home' target='_blank'>/%h</a>\n",
234 zUrl, zName);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
235 }else{
236 blob_append_sql(&html,
237 "<a href='%R/%T/home' target='_blank'>%h</a>\n",
238 zUrl, zName);
239 }
240
--- src/repolist.c
+++ src/repolist.c
@@ -230,10 +230,30 @@
230 blob_append_sql(&html, "%h (hidden)", zName);
231 } else if( allRepo && sqlite3_strglob("[a-zA-Z]:/?*", zName)!=0 ){
232 blob_append_sql(&html,
233 "<a href='%R/%T/home' target='_blank'>/%h</a>\n",
234 zUrl, zName);
235 }else if( sqlite3_strglob("*/*.fossil", zName)==0 ){
236 /* As described in
237 ** https://fossil-scm.org/forum/info/f50f647c97c72fc1: if
238 ** foo.fossil and foo/bar.fossil both exist and we create a
239 ** link to foo/bar/... then the URI dispatcher will instead
240 ** see that as a link to foo.fossil. In such cases, do not
241 ** emit a link to foo/bar.fossil. */
242 char * zDirPart = file_dirname(zName);
243 if( db_exists("SELECT 1 FROM sfile "
244 "WHERE pathname=(%Q || '.fossil') COLLATE nocase",
245 zDirPart) ){
246 blob_append_sql(&html,
247 "<s>%h</s> (directory/repo name collision)\n",
248 zName);
249 }else{
250 blob_append_sql(&html,
251 "<a href='%R/%T/home' target='_blank'>%h</a>\n",
252 zUrl, zName);
253 }
254 fossil_free(zDirPart);
255 }else{
256 blob_append_sql(&html,
257 "<a href='%R/%T/home' target='_blank'>%h</a>\n",
258 zUrl, zName);
259 }
260

Keyboard Shortcuts

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