Fossil SCM

Improvements to the "You Can Clone This Repository" section at the bottom of the /download page.

drh 2025-10-18 23:01 UTC timeline-enhance-2025
Commit 54e1d7dcfa18008fb754314ebf16d6cc0e13068fe363358bc4b4b4ecacf1b3c9
1 file changed +26 -17
+26 -17
--- src/tar.c
+++ src/tar.c
@@ -30,10 +30,27 @@
3030
char *zSpaces; /* Spaces for padding */
3131
char *zPrevDir; /* Name of directory for previous entry */
3232
int nPrevDirAlloc; /* size of zPrevDir */
3333
Blob pax; /* PAX data */
3434
} tball;
35
+
36
+/*
37
+** Convert a string so that it contains only lower-case ASCII, digits,
38
+** "_" and "-". Changes are made in-place.
39
+*/
40
+static void sanitize_name(char *zName){
41
+ int i;
42
+ char c;
43
+ for(i=0; (c = zName[i])!=0; i++){
44
+ if( fossil_isupper(c) ){
45
+ zName[i] = fossil_tolower(c);
46
+ }else if( !fossil_isalnum(c) && c!='_' && c!='-' ){
47
+ /* 123456789 123456789 123456 */
48
+ zName[i] = "abcdefghijklmnopqrstuvwxyz"[(unsigned)c%26];
49
+ }
50
+ }
51
+}
3552
3653
/*
3754
** Compute a sensible base-name for an archive file (tarball, ZIP, or SQLAR)
3855
** based on the rid of the check-in contained in that file.
3956
**
@@ -47,29 +64,20 @@
4764
** The value returned is obtained from mprintf() or fossil_strdup() and should
4865
** be released by the caller using fossil_free().
4966
*/
5067
char *archive_base_name(int rid){
5168
char *zName;
52
- int i;
53
- char c;
5469
zName = db_text(0,
5570
"SELECT coalesce(config.value,'unnamed')||"
5671
" strftime('-%%Y%%m%%d%%H%%M%%S-',event.mtime)||"
5772
" substr(blob.uuid,1,10)"
5873
" FROM blob, event LEFT JOIN config"
5974
" WHERE blob.rid=%d"
6075
" AND event.objid=%d"
6176
" AND config.name='project-name'",
6277
rid, rid);
63
- for(i=0; (c = zName[i])!=0; i++){
64
- if( fossil_isupper(c) ){
65
- zName[i] = fossil_tolower(c);
66
- }else if( !fossil_isalnum(c) && c!='_' && c!='-' ){
67
- /* 123456789 123456789 123456 */
68
- zName[i] = "abcdefghijklmnopqrstuvwxyz"[(unsigned)c%26];
69
- }
70
- }
78
+ sanitize_name(zName);
7179
return zName;
7280
}
7381
7482
7583
@@ -1241,25 +1249,26 @@
12411249
| TIMELINE_BRCOLOR;
12421250
www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, download_extra);
12431251
db_finalize(&q);
12441252
}
12451253
if( g.perm.Clone ){
1246
- const char *zNm = db_get("short-project-name","clone");
1254
+ char *zNm = fossil_strdup(db_get("project-name","clone"));
1255
+ sanitize_name(zNm);
12471256
@ <hr>
12481257
@ <h2>You Can Clone This Repository</h2>
1249
- @ <p>A clone gives you local access to all historical content.
1250
- @ Cloning is a bandwidth- and CPU-efficient alternative to extracting
1251
- @ multiple tarballs and ZIP archives for users who need access to many
1252
- @ different check-ins.
12531258
@
1254
- @ <p>Clone this repository by running a command like the following:
1259
+ @ <p>Clone this repository by running a command similar to the following:
12551260
@ <blockquote><pre>
12561261
@ fossil clone %s(g.zBaseURL) %h(zNm).fossil
12571262
@ </pre></blockquote>
1258
- @ <p>Do a web search for "fossil clone" or similar to find additional
1263
+ @ <p>A clone gives you local access to all historical content.
1264
+ @ Cloning is a bandwidth- and CPU-efficient alternative to extracting
1265
+ @ multiple tarballs and ZIPs.
1266
+ @ Do a web search for "fossil clone" or similar to find additional
12591267
@ information about using a cloned Fossil repository. Or ask your
12601268
@ favorite AI how to extract content from a Fossil clone.
1269
+ fossil_free(zNm);
12611270
}
12621271
12631272
style_finish_page();
12641273
}
12651274
12661275
--- src/tar.c
+++ src/tar.c
@@ -30,10 +30,27 @@
30 char *zSpaces; /* Spaces for padding */
31 char *zPrevDir; /* Name of directory for previous entry */
32 int nPrevDirAlloc; /* size of zPrevDir */
33 Blob pax; /* PAX data */
34 } tball;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
36 /*
37 ** Compute a sensible base-name for an archive file (tarball, ZIP, or SQLAR)
38 ** based on the rid of the check-in contained in that file.
39 **
@@ -47,29 +64,20 @@
47 ** The value returned is obtained from mprintf() or fossil_strdup() and should
48 ** be released by the caller using fossil_free().
49 */
50 char *archive_base_name(int rid){
51 char *zName;
52 int i;
53 char c;
54 zName = db_text(0,
55 "SELECT coalesce(config.value,'unnamed')||"
56 " strftime('-%%Y%%m%%d%%H%%M%%S-',event.mtime)||"
57 " substr(blob.uuid,1,10)"
58 " FROM blob, event LEFT JOIN config"
59 " WHERE blob.rid=%d"
60 " AND event.objid=%d"
61 " AND config.name='project-name'",
62 rid, rid);
63 for(i=0; (c = zName[i])!=0; i++){
64 if( fossil_isupper(c) ){
65 zName[i] = fossil_tolower(c);
66 }else if( !fossil_isalnum(c) && c!='_' && c!='-' ){
67 /* 123456789 123456789 123456 */
68 zName[i] = "abcdefghijklmnopqrstuvwxyz"[(unsigned)c%26];
69 }
70 }
71 return zName;
72 }
73
74
75
@@ -1241,25 +1249,26 @@
1241 | TIMELINE_BRCOLOR;
1242 www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, download_extra);
1243 db_finalize(&q);
1244 }
1245 if( g.perm.Clone ){
1246 const char *zNm = db_get("short-project-name","clone");
 
1247 @ <hr>
1248 @ <h2>You Can Clone This Repository</h2>
1249 @ <p>A clone gives you local access to all historical content.
1250 @ Cloning is a bandwidth- and CPU-efficient alternative to extracting
1251 @ multiple tarballs and ZIP archives for users who need access to many
1252 @ different check-ins.
1253 @
1254 @ <p>Clone this repository by running a command like the following:
1255 @ <blockquote><pre>
1256 @ fossil clone %s(g.zBaseURL) %h(zNm).fossil
1257 @ </pre></blockquote>
1258 @ <p>Do a web search for "fossil clone" or similar to find additional
 
 
 
1259 @ information about using a cloned Fossil repository. Or ask your
1260 @ favorite AI how to extract content from a Fossil clone.
 
1261 }
1262
1263 style_finish_page();
1264 }
1265
1266
--- src/tar.c
+++ src/tar.c
@@ -30,10 +30,27 @@
30 char *zSpaces; /* Spaces for padding */
31 char *zPrevDir; /* Name of directory for previous entry */
32 int nPrevDirAlloc; /* size of zPrevDir */
33 Blob pax; /* PAX data */
34 } tball;
35
36 /*
37 ** Convert a string so that it contains only lower-case ASCII, digits,
38 ** "_" and "-". Changes are made in-place.
39 */
40 static void sanitize_name(char *zName){
41 int i;
42 char c;
43 for(i=0; (c = zName[i])!=0; i++){
44 if( fossil_isupper(c) ){
45 zName[i] = fossil_tolower(c);
46 }else if( !fossil_isalnum(c) && c!='_' && c!='-' ){
47 /* 123456789 123456789 123456 */
48 zName[i] = "abcdefghijklmnopqrstuvwxyz"[(unsigned)c%26];
49 }
50 }
51 }
52
53 /*
54 ** Compute a sensible base-name for an archive file (tarball, ZIP, or SQLAR)
55 ** based on the rid of the check-in contained in that file.
56 **
@@ -47,29 +64,20 @@
64 ** The value returned is obtained from mprintf() or fossil_strdup() and should
65 ** be released by the caller using fossil_free().
66 */
67 char *archive_base_name(int rid){
68 char *zName;
 
 
69 zName = db_text(0,
70 "SELECT coalesce(config.value,'unnamed')||"
71 " strftime('-%%Y%%m%%d%%H%%M%%S-',event.mtime)||"
72 " substr(blob.uuid,1,10)"
73 " FROM blob, event LEFT JOIN config"
74 " WHERE blob.rid=%d"
75 " AND event.objid=%d"
76 " AND config.name='project-name'",
77 rid, rid);
78 sanitize_name(zName);
 
 
 
 
 
 
 
79 return zName;
80 }
81
82
83
@@ -1241,25 +1249,26 @@
1249 | TIMELINE_BRCOLOR;
1250 www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, download_extra);
1251 db_finalize(&q);
1252 }
1253 if( g.perm.Clone ){
1254 char *zNm = fossil_strdup(db_get("project-name","clone"));
1255 sanitize_name(zNm);
1256 @ <hr>
1257 @ <h2>You Can Clone This Repository</h2>
 
 
 
 
1258 @
1259 @ <p>Clone this repository by running a command similar to the following:
1260 @ <blockquote><pre>
1261 @ fossil clone %s(g.zBaseURL) %h(zNm).fossil
1262 @ </pre></blockquote>
1263 @ <p>A clone gives you local access to all historical content.
1264 @ Cloning is a bandwidth- and CPU-efficient alternative to extracting
1265 @ multiple tarballs and ZIPs.
1266 @ Do a web search for "fossil clone" or similar to find additional
1267 @ information about using a cloned Fossil repository. Or ask your
1268 @ favorite AI how to extract content from a Fossil clone.
1269 fossil_free(zNm);
1270 }
1271
1272 style_finish_page();
1273 }
1274
1275

Keyboard Shortcuts

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