Fossil SCM

Allow win32 forbidden characters to be used in filenames, using the Cygwin workaround: [http://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-specialchars]. The files test/00*.x should NOT be merged to trunk, otherwise trunk cannot be checked out with older win32 fossil versions any more!

jan.nijtmans 2013-03-22 09:36 trunk
Commit c68afe0f5bbb0376fe8fa33c45d61d994625b7c3
+2 -2
--- src/add.c
+++ src/add.c
@@ -374,11 +374,11 @@
374374
** In other words, this routine determines if two filenames that
375375
** differ only in case should be considered the same name or not.
376376
**
377377
** The case-sensitive setting determines the default value. If
378378
** the case-sensitive setting is undefined, then case sensitivity
379
-** defaults on for Mac and Windows and off for all other unix.
379
+** defaults on for Cygwin, Mac and Windows and off for all other unix.
380380
**
381381
** The --case-sensitive BOOLEAN command-line option overrides any
382382
** setting.
383383
*/
384384
int filenames_are_case_sensitive(void){
@@ -391,11 +391,11 @@
391391
caseSensitive = is_truth(zCaseSensitive);
392392
}else{
393393
#if !defined(_WIN32) && !defined(__CYGWIN__) && !defined(__DARWIN__) && !defined(__APPLE__)
394394
caseSensitive = 1; /* Unix */
395395
#else
396
- caseSensitive = 0; /* Windows and Mac */
396
+ caseSensitive = 0; /* Cygwin, Windows and Mac */
397397
#endif
398398
caseSensitive = db_get_boolean("case-sensitive",caseSensitive);
399399
}
400400
}
401401
return caseSensitive;
402402
--- src/add.c
+++ src/add.c
@@ -374,11 +374,11 @@
374 ** In other words, this routine determines if two filenames that
375 ** differ only in case should be considered the same name or not.
376 **
377 ** The case-sensitive setting determines the default value. If
378 ** the case-sensitive setting is undefined, then case sensitivity
379 ** defaults on for Mac and Windows and off for all other unix.
380 **
381 ** The --case-sensitive BOOLEAN command-line option overrides any
382 ** setting.
383 */
384 int filenames_are_case_sensitive(void){
@@ -391,11 +391,11 @@
391 caseSensitive = is_truth(zCaseSensitive);
392 }else{
393 #if !defined(_WIN32) && !defined(__CYGWIN__) && !defined(__DARWIN__) && !defined(__APPLE__)
394 caseSensitive = 1; /* Unix */
395 #else
396 caseSensitive = 0; /* Windows and Mac */
397 #endif
398 caseSensitive = db_get_boolean("case-sensitive",caseSensitive);
399 }
400 }
401 return caseSensitive;
402
--- src/add.c
+++ src/add.c
@@ -374,11 +374,11 @@
374 ** In other words, this routine determines if two filenames that
375 ** differ only in case should be considered the same name or not.
376 **
377 ** The case-sensitive setting determines the default value. If
378 ** the case-sensitive setting is undefined, then case sensitivity
379 ** defaults on for Cygwin, Mac and Windows and off for all other unix.
380 **
381 ** The --case-sensitive BOOLEAN command-line option overrides any
382 ** setting.
383 */
384 int filenames_are_case_sensitive(void){
@@ -391,11 +391,11 @@
391 caseSensitive = is_truth(zCaseSensitive);
392 }else{
393 #if !defined(_WIN32) && !defined(__CYGWIN__) && !defined(__DARWIN__) && !defined(__APPLE__)
394 caseSensitive = 1; /* Unix */
395 #else
396 caseSensitive = 0; /* Cygwin, Windows and Mac */
397 #endif
398 caseSensitive = db_get_boolean("case-sensitive",caseSensitive);
399 }
400 }
401 return caseSensitive;
402
+3 -3
--- src/db.c
+++ src/db.c
@@ -2179,19 +2179,19 @@
21792179
** for committing and merging purposes. Example: *.jpg
21802180
**
21812181
** case-sensitive If TRUE, the files whose names differ only in case
21822182
** care considered distinct. If FALSE files whose names
21832183
** differ only in case are the same file. Defaults to
2184
-** TRUE for unix and FALSE for windows and mac.
2184
+** TRUE for unix and FALSE for windows, Cygwin and mac.
21852185
**
21862186
** clearsign When enabled, fossil will attempt to sign all commits
21872187
** with gpg. When disabled (the default), commits will
21882188
** be unsigned. Default: off
21892189
**
21902190
** crnl-glob A comma or newline-separated list of GLOB patterns for
2191
-** (versionable) text files in which it is ok to have CR+NL line endings.
2192
-** Set to "*" to disable CR+NL checking.
2191
+** (versionable) text files in which it is ok to have NL or CR+NL line
2192
+** endings. Set to "*" to disable NL/CR+NL checking.
21932193
**
21942194
** default-perms Permissions given automatically to new users. For more
21952195
** information on permissions see Users page in Server
21962196
** Administration of the HTTP UI. Default: u.
21972197
**
21982198
--- src/db.c
+++ src/db.c
@@ -2179,19 +2179,19 @@
2179 ** for committing and merging purposes. Example: *.jpg
2180 **
2181 ** case-sensitive If TRUE, the files whose names differ only in case
2182 ** care considered distinct. If FALSE files whose names
2183 ** differ only in case are the same file. Defaults to
2184 ** TRUE for unix and FALSE for windows and mac.
2185 **
2186 ** clearsign When enabled, fossil will attempt to sign all commits
2187 ** with gpg. When disabled (the default), commits will
2188 ** be unsigned. Default: off
2189 **
2190 ** crnl-glob A comma or newline-separated list of GLOB patterns for
2191 ** (versionable) text files in which it is ok to have CR+NL line endings.
2192 ** Set to "*" to disable CR+NL checking.
2193 **
2194 ** default-perms Permissions given automatically to new users. For more
2195 ** information on permissions see Users page in Server
2196 ** Administration of the HTTP UI. Default: u.
2197 **
2198
--- src/db.c
+++ src/db.c
@@ -2179,19 +2179,19 @@
2179 ** for committing and merging purposes. Example: *.jpg
2180 **
2181 ** case-sensitive If TRUE, the files whose names differ only in case
2182 ** care considered distinct. If FALSE files whose names
2183 ** differ only in case are the same file. Defaults to
2184 ** TRUE for unix and FALSE for windows, Cygwin and mac.
2185 **
2186 ** clearsign When enabled, fossil will attempt to sign all commits
2187 ** with gpg. When disabled (the default), commits will
2188 ** be unsigned. Default: off
2189 **
2190 ** crnl-glob A comma or newline-separated list of GLOB patterns for
2191 ** (versionable) text files in which it is ok to have NL or CR+NL line
2192 ** endings. Set to "*" to disable NL/CR+NL checking.
2193 **
2194 ** default-perms Permissions given automatically to new users. For more
2195 ** information on permissions see Users page in Server
2196 ** Administration of the HTTP UI. Default: u.
2197 **
2198
+41 -5
--- src/utf8.c
+++ src/utf8.c
@@ -116,19 +116,37 @@
116116
** returned pointer when done.
117117
**
118118
** This function must not convert '\' to '/' on windows/cygwin, as it is
119119
** used in places where we are not sure it's really filenames we are handling,
120120
** e.g. fossil_getenv() or handling the argv arguments from main().
121
+**
122
+** On Windows, translate some characters in the in the range
123
+** U+F001 - U+F07F (private use area) to ASCII. Cygwin sometimes
124
+** generates such filenames. See:
125
+** <http://cygwin.com/cygwin-ug-net/using-specialnames.html>
121126
*/
122127
char *fossil_filename_to_utf8(const void *zFilename){
123128
#if defined(_WIN32)
124129
int nByte = WideCharToMultiByte(CP_UTF8, 0, zFilename, -1, 0, 0, 0, 0);
125130
char *zUtf = sqlite3_malloc( nByte );
131
+ char *pUtf, *qUtf;
126132
if( zUtf==0 ){
127133
return 0;
128134
}
129135
WideCharToMultiByte(CP_UTF8, 0, zFilename, -1, zUtf, nByte, 0, 0);
136
+ pUtf = qUtf = zUtf;
137
+ while( *pUtf ) {
138
+ if( *pUtf == (char)0xef ){
139
+ wchar_t c = ((pUtf[1]&0x3f)<<6)|(pUtf[2]&0x3f);
140
+ /* Only really convert it when the resulting char is in range. */
141
+ if ( c && ((c < ' ') || wcschr(L"\"*:<>?|", c)) ){
142
+ *qUtf++ = c; pUtf+=3; continue;
143
+ }
144
+ }
145
+ *qUtf++ = *pUtf++;
146
+ }
147
+ *qUtf = 0;
130148
return zUtf;
131149
#elif defined(__CYGWIN__)
132150
char *zOut;
133151
zOut = fossil_strdup(zFilename);
134152
return zOut;
@@ -161,14 +179,24 @@
161179
return (char *)zFilename; /* No-op on non-mac unix */
162180
#endif
163181
}
164182
165183
/*
166
-** Translate text from UTF-8 to the filename character set.
167
-** Return a pointer to the translated text.
168
-** Call fossil_filename_free() to deallocate any memory used to store the
169
-** returned pointer when done.
184
+** Translate UTF-8 to unicode for use in filename translations.
185
+** Return a pointer to the translated text.. Call fossil_filename_free()
186
+** to deallocate any memory used to store the returned pointer when done.
187
+**
188
+** On Windows, characters in the range U+0001 to U+0031 and the
189
+** characters '"', '*', ':', '<', '>', '?' and '|' are invalid
190
+** to be used. Therefore, translate those to characters in the
191
+** in the range U+F001 - U+F07F (private use area), so those
192
+** characters never arrive in any Windows API. The filenames might
193
+** look strange in Windows explorer, but in the cygwin shell
194
+** everything looks as expected.
195
+**
196
+** See: <http://cygwin.com/cygwin-ug-net/using-specialnames.html>
197
+**
170198
*/
171199
void *fossil_utf8_to_filename(const char *zUtf8){
172200
#ifdef _WIN32
173201
int nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, 0, 0);
174202
wchar_t *zUnicode = sqlite3_malloc( nChar * 2 );
@@ -175,12 +203,20 @@
175203
wchar_t *wUnicode = zUnicode;
176204
if( zUnicode==0 ){
177205
return 0;
178206
}
179207
MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zUnicode, nChar);
208
+ /* If path starts with "<drive>:/" or "<drive>:\", don't translate the ':' */
209
+ if( fossil_isalpha(zUtf8[0]) && zUtf8[1]==':'
210
+ && (zUtf8[2]=='\\' || zUtf8[2]=='/')) {
211
+ zUnicode[2] = '\\';
212
+ wUnicode += 3;
213
+ }
180214
while( *wUnicode != '\0' ){
181
- if( *wUnicode == '/' ){
215
+ if ( (*wUnicode < ' ') || wcschr(L"\"*:<>?|", *wUnicode) ){
216
+ *wUnicode |= 0xF000;
217
+ }else if( *wUnicode == '/' ){
182218
*wUnicode = '\\';
183219
}
184220
++wUnicode;
185221
}
186222
return zUnicode;
187223
188224
ADDED test/0022".x
189225
ADDED test/002A*.x
190226
ADDED test/003A:.x
191227
ADDED test/003C<.x
192228
ADDED test/003E>.x
193229
ADDED test/003F?.x
194230
ADDED test/007C|.x
--- src/utf8.c
+++ src/utf8.c
@@ -116,19 +116,37 @@
116 ** returned pointer when done.
117 **
118 ** This function must not convert '\' to '/' on windows/cygwin, as it is
119 ** used in places where we are not sure it's really filenames we are handling,
120 ** e.g. fossil_getenv() or handling the argv arguments from main().
 
 
 
 
 
121 */
122 char *fossil_filename_to_utf8(const void *zFilename){
123 #if defined(_WIN32)
124 int nByte = WideCharToMultiByte(CP_UTF8, 0, zFilename, -1, 0, 0, 0, 0);
125 char *zUtf = sqlite3_malloc( nByte );
 
126 if( zUtf==0 ){
127 return 0;
128 }
129 WideCharToMultiByte(CP_UTF8, 0, zFilename, -1, zUtf, nByte, 0, 0);
 
 
 
 
 
 
 
 
 
 
 
 
130 return zUtf;
131 #elif defined(__CYGWIN__)
132 char *zOut;
133 zOut = fossil_strdup(zFilename);
134 return zOut;
@@ -161,14 +179,24 @@
161 return (char *)zFilename; /* No-op on non-mac unix */
162 #endif
163 }
164
165 /*
166 ** Translate text from UTF-8 to the filename character set.
167 ** Return a pointer to the translated text.
168 ** Call fossil_filename_free() to deallocate any memory used to store the
169 ** returned pointer when done.
 
 
 
 
 
 
 
 
 
 
170 */
171 void *fossil_utf8_to_filename(const char *zUtf8){
172 #ifdef _WIN32
173 int nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, 0, 0);
174 wchar_t *zUnicode = sqlite3_malloc( nChar * 2 );
@@ -175,12 +203,20 @@
175 wchar_t *wUnicode = zUnicode;
176 if( zUnicode==0 ){
177 return 0;
178 }
179 MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zUnicode, nChar);
 
 
 
 
 
 
180 while( *wUnicode != '\0' ){
181 if( *wUnicode == '/' ){
 
 
182 *wUnicode = '\\';
183 }
184 ++wUnicode;
185 }
186 return zUnicode;
187
188 DDED test/0022".x
189 DDED test/002A*.x
190 DDED test/003A:.x
191 DDED test/003C<.x
192 DDED test/003E>.x
193 DDED test/003F?.x
194 DDED test/007C|.x
--- src/utf8.c
+++ src/utf8.c
@@ -116,19 +116,37 @@
116 ** returned pointer when done.
117 **
118 ** This function must not convert '\' to '/' on windows/cygwin, as it is
119 ** used in places where we are not sure it's really filenames we are handling,
120 ** e.g. fossil_getenv() or handling the argv arguments from main().
121 **
122 ** On Windows, translate some characters in the in the range
123 ** U+F001 - U+F07F (private use area) to ASCII. Cygwin sometimes
124 ** generates such filenames. See:
125 ** <http://cygwin.com/cygwin-ug-net/using-specialnames.html>
126 */
127 char *fossil_filename_to_utf8(const void *zFilename){
128 #if defined(_WIN32)
129 int nByte = WideCharToMultiByte(CP_UTF8, 0, zFilename, -1, 0, 0, 0, 0);
130 char *zUtf = sqlite3_malloc( nByte );
131 char *pUtf, *qUtf;
132 if( zUtf==0 ){
133 return 0;
134 }
135 WideCharToMultiByte(CP_UTF8, 0, zFilename, -1, zUtf, nByte, 0, 0);
136 pUtf = qUtf = zUtf;
137 while( *pUtf ) {
138 if( *pUtf == (char)0xef ){
139 wchar_t c = ((pUtf[1]&0x3f)<<6)|(pUtf[2]&0x3f);
140 /* Only really convert it when the resulting char is in range. */
141 if ( c && ((c < ' ') || wcschr(L"\"*:<>?|", c)) ){
142 *qUtf++ = c; pUtf+=3; continue;
143 }
144 }
145 *qUtf++ = *pUtf++;
146 }
147 *qUtf = 0;
148 return zUtf;
149 #elif defined(__CYGWIN__)
150 char *zOut;
151 zOut = fossil_strdup(zFilename);
152 return zOut;
@@ -161,14 +179,24 @@
179 return (char *)zFilename; /* No-op on non-mac unix */
180 #endif
181 }
182
183 /*
184 ** Translate UTF-8 to unicode for use in filename translations.
185 ** Return a pointer to the translated text.. Call fossil_filename_free()
186 ** to deallocate any memory used to store the returned pointer when done.
187 **
188 ** On Windows, characters in the range U+0001 to U+0031 and the
189 ** characters '"', '*', ':', '<', '>', '?' and '|' are invalid
190 ** to be used. Therefore, translate those to characters in the
191 ** in the range U+F001 - U+F07F (private use area), so those
192 ** characters never arrive in any Windows API. The filenames might
193 ** look strange in Windows explorer, but in the cygwin shell
194 ** everything looks as expected.
195 **
196 ** See: <http://cygwin.com/cygwin-ug-net/using-specialnames.html>
197 **
198 */
199 void *fossil_utf8_to_filename(const char *zUtf8){
200 #ifdef _WIN32
201 int nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, 0, 0);
202 wchar_t *zUnicode = sqlite3_malloc( nChar * 2 );
@@ -175,12 +203,20 @@
203 wchar_t *wUnicode = zUnicode;
204 if( zUnicode==0 ){
205 return 0;
206 }
207 MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zUnicode, nChar);
208 /* If path starts with "<drive>:/" or "<drive>:\", don't translate the ':' */
209 if( fossil_isalpha(zUtf8[0]) && zUtf8[1]==':'
210 && (zUtf8[2]=='\\' || zUtf8[2]=='/')) {
211 zUnicode[2] = '\\';
212 wUnicode += 3;
213 }
214 while( *wUnicode != '\0' ){
215 if ( (*wUnicode < ' ') || wcschr(L"\"*:<>?|", *wUnicode) ){
216 *wUnicode |= 0xF000;
217 }else if( *wUnicode == '/' ){
218 *wUnicode = '\\';
219 }
220 ++wUnicode;
221 }
222 return zUnicode;
223
224 DDED test/0022".x
225 DDED test/002A*.x
226 DDED test/003A:.x
227 DDED test/003C<.x
228 DDED test/003E>.x
229 DDED test/003F?.x
230 DDED test/007C|.x

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

No diff available

--- www/changes.wiki
+++ www/changes.wiki
@@ -1,13 +1,19 @@
11
<title>Change Log</title>
22
33
<h2>Changes For Version 1.26 (as yet unreleased)</h2>
4
+ * Win32: Fossil now understands Cygwin paths containing one or more of
5
+ the characters <nowiki>"*:<>?|</nowiki>. Those are normally forbidden in
6
+ win32. This means that the win32 fossil.exe is better usable in a Cygwin
7
+ environment. See
8
+ [http://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-specialchars].
9
+ * Cygwin: Fossil now understands win32 absolute paths starting with a drive letter
10
+ everywhere. The default value of the "case-sensitive" setting is now FALSE.
411
* Enhancements to /timeline.rss, adding more flags for filtering
512
results, including the ability to subscribe to changes made
613
to individual tickets. For example: [/timeline.rss?y=t&tkt=12fceeec82].
714
* JSON API: added the 'status' command to report local checkout status.
8
-
915
1016
<h2>Changes For Version 1.25 (2013-02-16)</h2>
1117
* Enhancements to ticket processing. There are now two tables: TICKET and
1218
TICKETCHNG. There is one row in TICKETCHNG for each ticket artifact.
1319
Fields from ticket artifacts go into either or both of TICKET and
1420
--- www/changes.wiki
+++ www/changes.wiki
@@ -1,13 +1,19 @@
1 <title>Change Log</title>
2
3 <h2>Changes For Version 1.26 (as yet unreleased)</h2>
 
 
 
 
 
 
 
4 * Enhancements to /timeline.rss, adding more flags for filtering
5 results, including the ability to subscribe to changes made
6 to individual tickets. For example: [/timeline.rss?y=t&tkt=12fceeec82].
7 * JSON API: added the 'status' command to report local checkout status.
8
9
10 <h2>Changes For Version 1.25 (2013-02-16)</h2>
11 * Enhancements to ticket processing. There are now two tables: TICKET and
12 TICKETCHNG. There is one row in TICKETCHNG for each ticket artifact.
13 Fields from ticket artifacts go into either or both of TICKET and
14
--- www/changes.wiki
+++ www/changes.wiki
@@ -1,13 +1,19 @@
1 <title>Change Log</title>
2
3 <h2>Changes For Version 1.26 (as yet unreleased)</h2>
4 * Win32: Fossil now understands Cygwin paths containing one or more of
5 the characters <nowiki>"*:<>?|</nowiki>. Those are normally forbidden in
6 win32. This means that the win32 fossil.exe is better usable in a Cygwin
7 environment. See
8 [http://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-specialchars].
9 * Cygwin: Fossil now understands win32 absolute paths starting with a drive letter
10 everywhere. The default value of the "case-sensitive" setting is now FALSE.
11 * Enhancements to /timeline.rss, adding more flags for filtering
12 results, including the ability to subscribe to changes made
13 to individual tickets. For example: [/timeline.rss?y=t&tkt=12fceeec82].
14 * JSON API: added the 'status' command to report local checkout status.
 
15
16 <h2>Changes For Version 1.25 (2013-02-16)</h2>
17 * Enhancements to ticket processing. There are now two tables: TICKET and
18 TICKETCHNG. There is one row in TICKETCHNG for each ticket artifact.
19 Fields from ticket artifacts go into either or both of TICKET and
20

Keyboard Shortcuts

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