Fossil SCM

Merge the --case-sensitive feature into trunk.

drh 2011-08-04 22:17 trunk merge
Commit 874d0ca303a97805bc2bb2b160ccfab83e7e133a
3 files changed +75 -21 +8 -2 +10 -2
+75 -21
--- src/add.c
+++ src/add.c
@@ -92,66 +92,77 @@
9292
**
9393
** Omit any file whose name is pOmit.
9494
*/
9595
static int add_one_file(
9696
const char *zPath, /* Tree-name of file to add. */
97
- int vid /* Add to this VFILE */
97
+ int vid, /* Add to this VFILE */
98
+ int caseSensitive /* True if filenames are case sensitive */
9899
){
100
+ const char *zCollate = caseSensitive ? "binary" : "nocase";
99101
if( !file_is_simple_pathname(zPath) ){
100102
fossil_fatal("filename contains illegal characters: %s", zPath);
101103
}
102
-#if defined(_WIN32)
103104
if( db_exists("SELECT 1 FROM vfile"
104
- " WHERE pathname=%Q COLLATE nocase", zPath) ){
105
+ " WHERE pathname=%Q COLLATE %s", zPath, zCollate) ){
105106
db_multi_exec("UPDATE vfile SET deleted=0"
106
- " WHERE pathname=%Q COLLATE nocase", zPath);
107
- }
108
-#else
109
- if( db_exists("SELECT 1 FROM vfile WHERE pathname=%Q", zPath) ){
110
- db_multi_exec("UPDATE vfile SET deleted=0 WHERE pathname=%Q", zPath);
111
- }
112
-#endif
113
- else{
107
+ " WHERE pathname=%Q COLLATE %s", zPath, zCollate);
108
+ }else{
114109
char *zFullname = mprintf("%s%s", g.zLocalRoot, zPath);
115110
db_multi_exec(
116111
"INSERT INTO vfile(vid,deleted,rid,mrid,pathname,isexe)"
117112
"VALUES(%d,0,0,0,%Q,%d)",
118113
vid, zPath, file_isexe(zFullname));
119114
fossil_free(zFullname);
120115
}
121
- fossil_print("ADDED %s\n", zPath);
122
- return 1;
116
+ if( db_changes() ){
117
+ fossil_print("ADDED %s\n", zPath);
118
+ return 1;
119
+ }else{
120
+ fossil_print("SKIP %s\n", zPath);
121
+ return 0;
122
+ }
123123
}
124124
125125
/*
126126
** Add all files in the sfile temp table.
127127
**
128128
** Automatically exclude the repository file.
129129
*/
130
-static int add_files_in_sfile(int vid){
130
+static int add_files_in_sfile(int vid, int caseSensitive){
131131
const char *zRepo; /* Name of the repository database file */
132132
int nAdd = 0; /* Number of files added */
133133
int i; /* Loop counter */
134134
const char *zReserved; /* Name of a reserved file */
135135
Blob repoName; /* Treename of the repository */
136136
Stmt loop; /* SQL to loop over all files to add */
137
+ int (*xCmp)(const char*,const char*);
137138
138139
if( !file_tree_name(g.zRepositoryName, &repoName, 0) ){
139140
blob_zero(&repoName);
140141
zRepo = "";
141142
}else{
142143
zRepo = blob_str(&repoName);
143144
}
145
+ if( caseSensitive ){
146
+ xCmp = fossil_strcmp;
147
+ }else{
148
+ xCmp = fossil_stricmp;
149
+ db_multi_exec(
150
+ "CREATE INDEX IF NOT EXISTS vfile_nocase"
151
+ " ON vfile(pathname COLLATE nocase)"
152
+ );
153
+ }
154
+ xCmp = caseSensitive ? fossil_strcmp : fossil_stricmp;
144155
db_prepare(&loop, "SELECT x FROM sfile ORDER BY x");
145156
while( db_step(&loop)==SQLITE_ROW ){
146157
const char *zToAdd = db_column_text(&loop, 0);
147158
if( fossil_strcmp(zToAdd, zRepo)==0 ) continue;
148159
for(i=0; (zReserved = fossil_reserved_name(i))!=0; i++){
149
- if( fossil_strcmp(zToAdd, zReserved)==0 ) break;
160
+ if( xCmp(zToAdd, zReserved)==0 ) break;
150161
}
151162
if( zReserved ) continue;
152
- nAdd += add_one_file(zToAdd, vid);
163
+ nAdd += add_one_file(zToAdd, vid, caseSensitive);
153164
}
154165
db_finalize(&loop);
155166
blob_reset(&repoName);
156167
return nAdd;
157168
}
@@ -180,14 +191,17 @@
180191
int i; /* Loop counter */
181192
int vid; /* Currently checked out version */
182193
int nRoot; /* Full path characters in g.zLocalRoot */
183194
const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */
184195
Glob *pIgnore; /* Ignore everything matching this glob pattern */
196
+ int caseSensitive; /* True if filenames are case sensitive */
185197
186198
zIgnoreFlag = find_option("ignore",0,1);
187199
includeDotFiles = find_option("dotfiles",0,0)!=0;
200
+ capture_case_sensitive_option();
188201
db_must_be_within_tree();
202
+ caseSensitive = filenames_are_case_sensitive();
189203
if( zIgnoreFlag==0 ){
190204
zIgnoreFlag = db_get("ignore-glob", 0);
191205
}
192206
vid = db_lget_int("checkout",0);
193207
if( vid==0 ){
@@ -229,11 +243,11 @@
229243
}
230244
blob_reset(&fullName);
231245
}
232246
glob_free(pIgnore);
233247
234
- add_files_in_sfile(vid);
248
+ add_files_in_sfile(vid, caseSensitive);
235249
db_end_transaction(0);
236250
}
237251
238252
/*
239253
** COMMAND: rm
@@ -289,10 +303,48 @@
289303
"UPDATE vfile SET deleted=1 WHERE pathname IN sfile;"
290304
"DELETE FROM vfile WHERE rid=0 AND deleted;"
291305
);
292306
db_end_transaction(0);
293307
}
308
+
309
+/*
310
+** Capture the command-line --case-sensitive option.
311
+*/
312
+static const char *zCaseSensitive = 0;
313
+void capture_case_sensitive_option(void){
314
+ if( zCaseSensitive==0 ){
315
+ zCaseSensitive = find_option("case-sensitive",0,1);
316
+ }
317
+}
318
+
319
+/*
320
+** This routine determines if files should be case-sensitive or not.
321
+** In other words, this routine determines if two filenames that
322
+** differ only in case should be considered the same name or not.
323
+**
324
+** The case-sensitive setting determines the default value. If
325
+** the case-sensitive setting is undefined, then case sensitivity
326
+** defaults on for Mac and Windows and off for all other unix.
327
+**
328
+** The --case-sensitive BOOLEAN command-line option overrides any
329
+** setting.
330
+*/
331
+int filenames_are_case_sensitive(void){
332
+ int caseSensitive;
333
+
334
+ if( zCaseSensitive ){
335
+ caseSensitive = is_truth(zCaseSensitive);
336
+ }else{
337
+#if !defined(_WIN32) && !defined(__DARWIN__) && !defined(__APPLE__)
338
+ caseSensitive = 1;
339
+#else
340
+ caseSensitive = 0;
341
+#endif
342
+ caseSensitive = db_get_boolean("case-sensitive",caseSensitive);
343
+ }
344
+ return caseSensitive;
345
+}
294346
295347
/*
296348
** COMMAND: addremove
297349
**
298350
** Usage: %fossil addremove ?--dotfiles? ?--ignore GLOBPATTERN? ?--test?
@@ -319,27 +371,29 @@
319371
**
320372
** The --test option shows what would happen without actually doing anything.
321373
**
322374
** This command can be used to track third party software.
323375
**
324
-**
325376
** SUMMARY: fossil addremove
326
-** Options: ?--dotfiles? ?--ignore GLOBPATTERN? ?--test?
377
+** Options: ?--dotfiles? ?--ignore GLOB? ?--test? ?--case-sensitive BOOL?
327378
*/
328
-void import_cmd(void){
379
+void addremove_cmd(void){
329380
Blob path;
330381
const char *zIgnoreFlag = find_option("ignore",0,1);
331382
int allFlag = find_option("dotfiles",0,0)!=0;
332383
int isTest = find_option("test",0,0)!=0;
384
+ int caseSensitive;
333385
int n;
334386
Stmt q;
335387
int vid;
336388
int nAdd = 0;
337389
int nDelete = 0;
338390
Glob *pIgnore;
339391
392
+ capture_case_sensitive_option();
340393
db_must_be_within_tree();
394
+ caseSensitive = filenames_are_case_sensitive();
341395
if( zIgnoreFlag==0 ){
342396
zIgnoreFlag = db_get("ignore-glob", 0);
343397
}
344398
vid = db_lget_int("checkout",0);
345399
if( vid==0 ){
@@ -358,11 +412,11 @@
358412
blob_init(&path, g.zLocalRoot, n-1);
359413
/* now we read the complete file structure into a temp table */
360414
pIgnore = glob_create(zIgnoreFlag);
361415
vfile_scan(&path, blob_size(&path), allFlag, pIgnore);
362416
glob_free(pIgnore);
363
- nAdd = add_files_in_sfile(vid);
417
+ nAdd = add_files_in_sfile(vid, caseSensitive);
364418
365419
/* step 2: search for missing files */
366420
db_prepare(&q,
367421
"SELECT pathname, %Q || pathname, deleted FROM vfile"
368422
" WHERE NOT deleted"
369423
--- src/add.c
+++ src/add.c
@@ -92,66 +92,77 @@
92 **
93 ** Omit any file whose name is pOmit.
94 */
95 static int add_one_file(
96 const char *zPath, /* Tree-name of file to add. */
97 int vid /* Add to this VFILE */
 
98 ){
 
99 if( !file_is_simple_pathname(zPath) ){
100 fossil_fatal("filename contains illegal characters: %s", zPath);
101 }
102 #if defined(_WIN32)
103 if( db_exists("SELECT 1 FROM vfile"
104 " WHERE pathname=%Q COLLATE nocase", zPath) ){
105 db_multi_exec("UPDATE vfile SET deleted=0"
106 " WHERE pathname=%Q COLLATE nocase", zPath);
107 }
108 #else
109 if( db_exists("SELECT 1 FROM vfile WHERE pathname=%Q", zPath) ){
110 db_multi_exec("UPDATE vfile SET deleted=0 WHERE pathname=%Q", zPath);
111 }
112 #endif
113 else{
114 char *zFullname = mprintf("%s%s", g.zLocalRoot, zPath);
115 db_multi_exec(
116 "INSERT INTO vfile(vid,deleted,rid,mrid,pathname,isexe)"
117 "VALUES(%d,0,0,0,%Q,%d)",
118 vid, zPath, file_isexe(zFullname));
119 fossil_free(zFullname);
120 }
121 fossil_print("ADDED %s\n", zPath);
122 return 1;
 
 
 
 
 
123 }
124
125 /*
126 ** Add all files in the sfile temp table.
127 **
128 ** Automatically exclude the repository file.
129 */
130 static int add_files_in_sfile(int vid){
131 const char *zRepo; /* Name of the repository database file */
132 int nAdd = 0; /* Number of files added */
133 int i; /* Loop counter */
134 const char *zReserved; /* Name of a reserved file */
135 Blob repoName; /* Treename of the repository */
136 Stmt loop; /* SQL to loop over all files to add */
 
137
138 if( !file_tree_name(g.zRepositoryName, &repoName, 0) ){
139 blob_zero(&repoName);
140 zRepo = "";
141 }else{
142 zRepo = blob_str(&repoName);
143 }
 
 
 
 
 
 
 
 
 
 
144 db_prepare(&loop, "SELECT x FROM sfile ORDER BY x");
145 while( db_step(&loop)==SQLITE_ROW ){
146 const char *zToAdd = db_column_text(&loop, 0);
147 if( fossil_strcmp(zToAdd, zRepo)==0 ) continue;
148 for(i=0; (zReserved = fossil_reserved_name(i))!=0; i++){
149 if( fossil_strcmp(zToAdd, zReserved)==0 ) break;
150 }
151 if( zReserved ) continue;
152 nAdd += add_one_file(zToAdd, vid);
153 }
154 db_finalize(&loop);
155 blob_reset(&repoName);
156 return nAdd;
157 }
@@ -180,14 +191,17 @@
180 int i; /* Loop counter */
181 int vid; /* Currently checked out version */
182 int nRoot; /* Full path characters in g.zLocalRoot */
183 const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */
184 Glob *pIgnore; /* Ignore everything matching this glob pattern */
 
185
186 zIgnoreFlag = find_option("ignore",0,1);
187 includeDotFiles = find_option("dotfiles",0,0)!=0;
 
188 db_must_be_within_tree();
 
189 if( zIgnoreFlag==0 ){
190 zIgnoreFlag = db_get("ignore-glob", 0);
191 }
192 vid = db_lget_int("checkout",0);
193 if( vid==0 ){
@@ -229,11 +243,11 @@
229 }
230 blob_reset(&fullName);
231 }
232 glob_free(pIgnore);
233
234 add_files_in_sfile(vid);
235 db_end_transaction(0);
236 }
237
238 /*
239 ** COMMAND: rm
@@ -289,10 +303,48 @@
289 "UPDATE vfile SET deleted=1 WHERE pathname IN sfile;"
290 "DELETE FROM vfile WHERE rid=0 AND deleted;"
291 );
292 db_end_transaction(0);
293 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
294
295 /*
296 ** COMMAND: addremove
297 **
298 ** Usage: %fossil addremove ?--dotfiles? ?--ignore GLOBPATTERN? ?--test?
@@ -319,27 +371,29 @@
319 **
320 ** The --test option shows what would happen without actually doing anything.
321 **
322 ** This command can be used to track third party software.
323 **
324 **
325 ** SUMMARY: fossil addremove
326 ** Options: ?--dotfiles? ?--ignore GLOBPATTERN? ?--test?
327 */
328 void import_cmd(void){
329 Blob path;
330 const char *zIgnoreFlag = find_option("ignore",0,1);
331 int allFlag = find_option("dotfiles",0,0)!=0;
332 int isTest = find_option("test",0,0)!=0;
 
333 int n;
334 Stmt q;
335 int vid;
336 int nAdd = 0;
337 int nDelete = 0;
338 Glob *pIgnore;
339
 
340 db_must_be_within_tree();
 
341 if( zIgnoreFlag==0 ){
342 zIgnoreFlag = db_get("ignore-glob", 0);
343 }
344 vid = db_lget_int("checkout",0);
345 if( vid==0 ){
@@ -358,11 +412,11 @@
358 blob_init(&path, g.zLocalRoot, n-1);
359 /* now we read the complete file structure into a temp table */
360 pIgnore = glob_create(zIgnoreFlag);
361 vfile_scan(&path, blob_size(&path), allFlag, pIgnore);
362 glob_free(pIgnore);
363 nAdd = add_files_in_sfile(vid);
364
365 /* step 2: search for missing files */
366 db_prepare(&q,
367 "SELECT pathname, %Q || pathname, deleted FROM vfile"
368 " WHERE NOT deleted"
369
--- src/add.c
+++ src/add.c
@@ -92,66 +92,77 @@
92 **
93 ** Omit any file whose name is pOmit.
94 */
95 static int add_one_file(
96 const char *zPath, /* Tree-name of file to add. */
97 int vid, /* Add to this VFILE */
98 int caseSensitive /* True if filenames are case sensitive */
99 ){
100 const char *zCollate = caseSensitive ? "binary" : "nocase";
101 if( !file_is_simple_pathname(zPath) ){
102 fossil_fatal("filename contains illegal characters: %s", zPath);
103 }
 
104 if( db_exists("SELECT 1 FROM vfile"
105 " WHERE pathname=%Q COLLATE %s", zPath, zCollate) ){
106 db_multi_exec("UPDATE vfile SET deleted=0"
107 " WHERE pathname=%Q COLLATE %s", zPath, zCollate);
108 }else{
 
 
 
 
 
 
109 char *zFullname = mprintf("%s%s", g.zLocalRoot, zPath);
110 db_multi_exec(
111 "INSERT INTO vfile(vid,deleted,rid,mrid,pathname,isexe)"
112 "VALUES(%d,0,0,0,%Q,%d)",
113 vid, zPath, file_isexe(zFullname));
114 fossil_free(zFullname);
115 }
116 if( db_changes() ){
117 fossil_print("ADDED %s\n", zPath);
118 return 1;
119 }else{
120 fossil_print("SKIP %s\n", zPath);
121 return 0;
122 }
123 }
124
125 /*
126 ** Add all files in the sfile temp table.
127 **
128 ** Automatically exclude the repository file.
129 */
130 static int add_files_in_sfile(int vid, int caseSensitive){
131 const char *zRepo; /* Name of the repository database file */
132 int nAdd = 0; /* Number of files added */
133 int i; /* Loop counter */
134 const char *zReserved; /* Name of a reserved file */
135 Blob repoName; /* Treename of the repository */
136 Stmt loop; /* SQL to loop over all files to add */
137 int (*xCmp)(const char*,const char*);
138
139 if( !file_tree_name(g.zRepositoryName, &repoName, 0) ){
140 blob_zero(&repoName);
141 zRepo = "";
142 }else{
143 zRepo = blob_str(&repoName);
144 }
145 if( caseSensitive ){
146 xCmp = fossil_strcmp;
147 }else{
148 xCmp = fossil_stricmp;
149 db_multi_exec(
150 "CREATE INDEX IF NOT EXISTS vfile_nocase"
151 " ON vfile(pathname COLLATE nocase)"
152 );
153 }
154 xCmp = caseSensitive ? fossil_strcmp : fossil_stricmp;
155 db_prepare(&loop, "SELECT x FROM sfile ORDER BY x");
156 while( db_step(&loop)==SQLITE_ROW ){
157 const char *zToAdd = db_column_text(&loop, 0);
158 if( fossil_strcmp(zToAdd, zRepo)==0 ) continue;
159 for(i=0; (zReserved = fossil_reserved_name(i))!=0; i++){
160 if( xCmp(zToAdd, zReserved)==0 ) break;
161 }
162 if( zReserved ) continue;
163 nAdd += add_one_file(zToAdd, vid, caseSensitive);
164 }
165 db_finalize(&loop);
166 blob_reset(&repoName);
167 return nAdd;
168 }
@@ -180,14 +191,17 @@
191 int i; /* Loop counter */
192 int vid; /* Currently checked out version */
193 int nRoot; /* Full path characters in g.zLocalRoot */
194 const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */
195 Glob *pIgnore; /* Ignore everything matching this glob pattern */
196 int caseSensitive; /* True if filenames are case sensitive */
197
198 zIgnoreFlag = find_option("ignore",0,1);
199 includeDotFiles = find_option("dotfiles",0,0)!=0;
200 capture_case_sensitive_option();
201 db_must_be_within_tree();
202 caseSensitive = filenames_are_case_sensitive();
203 if( zIgnoreFlag==0 ){
204 zIgnoreFlag = db_get("ignore-glob", 0);
205 }
206 vid = db_lget_int("checkout",0);
207 if( vid==0 ){
@@ -229,11 +243,11 @@
243 }
244 blob_reset(&fullName);
245 }
246 glob_free(pIgnore);
247
248 add_files_in_sfile(vid, caseSensitive);
249 db_end_transaction(0);
250 }
251
252 /*
253 ** COMMAND: rm
@@ -289,10 +303,48 @@
303 "UPDATE vfile SET deleted=1 WHERE pathname IN sfile;"
304 "DELETE FROM vfile WHERE rid=0 AND deleted;"
305 );
306 db_end_transaction(0);
307 }
308
309 /*
310 ** Capture the command-line --case-sensitive option.
311 */
312 static const char *zCaseSensitive = 0;
313 void capture_case_sensitive_option(void){
314 if( zCaseSensitive==0 ){
315 zCaseSensitive = find_option("case-sensitive",0,1);
316 }
317 }
318
319 /*
320 ** This routine determines if files should be case-sensitive or not.
321 ** In other words, this routine determines if two filenames that
322 ** differ only in case should be considered the same name or not.
323 **
324 ** The case-sensitive setting determines the default value. If
325 ** the case-sensitive setting is undefined, then case sensitivity
326 ** defaults on for Mac and Windows and off for all other unix.
327 **
328 ** The --case-sensitive BOOLEAN command-line option overrides any
329 ** setting.
330 */
331 int filenames_are_case_sensitive(void){
332 int caseSensitive;
333
334 if( zCaseSensitive ){
335 caseSensitive = is_truth(zCaseSensitive);
336 }else{
337 #if !defined(_WIN32) && !defined(__DARWIN__) && !defined(__APPLE__)
338 caseSensitive = 1;
339 #else
340 caseSensitive = 0;
341 #endif
342 caseSensitive = db_get_boolean("case-sensitive",caseSensitive);
343 }
344 return caseSensitive;
345 }
346
347 /*
348 ** COMMAND: addremove
349 **
350 ** Usage: %fossil addremove ?--dotfiles? ?--ignore GLOBPATTERN? ?--test?
@@ -319,27 +371,29 @@
371 **
372 ** The --test option shows what would happen without actually doing anything.
373 **
374 ** This command can be used to track third party software.
375 **
 
376 ** SUMMARY: fossil addremove
377 ** Options: ?--dotfiles? ?--ignore GLOB? ?--test? ?--case-sensitive BOOL?
378 */
379 void addremove_cmd(void){
380 Blob path;
381 const char *zIgnoreFlag = find_option("ignore",0,1);
382 int allFlag = find_option("dotfiles",0,0)!=0;
383 int isTest = find_option("test",0,0)!=0;
384 int caseSensitive;
385 int n;
386 Stmt q;
387 int vid;
388 int nAdd = 0;
389 int nDelete = 0;
390 Glob *pIgnore;
391
392 capture_case_sensitive_option();
393 db_must_be_within_tree();
394 caseSensitive = filenames_are_case_sensitive();
395 if( zIgnoreFlag==0 ){
396 zIgnoreFlag = db_get("ignore-glob", 0);
397 }
398 vid = db_lget_int("checkout",0);
399 if( vid==0 ){
@@ -358,11 +412,11 @@
412 blob_init(&path, g.zLocalRoot, n-1);
413 /* now we read the complete file structure into a temp table */
414 pIgnore = glob_create(zIgnoreFlag);
415 vfile_scan(&path, blob_size(&path), allFlag, pIgnore);
416 glob_free(pIgnore);
417 nAdd = add_files_in_sfile(vid, caseSensitive);
418
419 /* step 2: search for missing files */
420 db_prepare(&q,
421 "SELECT pathname, %Q || pathname, deleted FROM vfile"
422 " WHERE NOT deleted"
423
+8 -2
--- src/db.c
+++ src/db.c
@@ -1366,19 +1366,19 @@
13661366
*/
13671367
int is_truth(const char *zVal){
13681368
static const char *azOn[] = { "on", "yes", "true", "1" };
13691369
int i;
13701370
for(i=0; i<sizeof(azOn)/sizeof(azOn[0]); i++){
1371
- if( fossil_strcmp(zVal,azOn[i])==0 ) return 1;
1371
+ if( fossil_stricmp(zVal,azOn[i])==0 ) return 1;
13721372
}
13731373
return 0;
13741374
}
13751375
int is_false(const char *zVal){
13761376
static const char *azOff[] = { "off", "no", "false", "0" };
13771377
int i;
13781378
for(i=0; i<sizeof(azOff)/sizeof(azOff[0]); i++){
1379
- if( fossil_strcmp(zVal,azOff[i])==0 ) return 1;
1379
+ if( fossil_stricmp(zVal,azOff[i])==0 ) return 1;
13801380
}
13811381
return 0;
13821382
}
13831383
13841384
/*
@@ -1647,10 +1647,11 @@
16471647
{ "access-log", 0, 0, "off" },
16481648
{ "auto-captcha", "autocaptcha", 0, "on" },
16491649
{ "auto-shun", 0, 0, "on" },
16501650
{ "autosync", 0, 0, "on" },
16511651
{ "binary-glob", 0, 32, "" },
1652
+ { "case-sensitive",0, 0, "on" },
16521653
{ "clearsign", 0, 0, "off" },
16531654
{ "crnl-glob", 0, 16, "" },
16541655
{ "default-perms", 0, 16, "u" },
16551656
{ "diff-command", 0, 16, "" },
16561657
{ "dont-push", 0, 0, "off" },
@@ -1703,10 +1704,15 @@
17031704
** Default: on
17041705
**
17051706
** binary-glob The VALUE is a comma-separated list of GLOB patterns
17061707
** that should be treated as binary files for merging
17071708
** purposes. Example: *.xml
1709
+**
1710
+** case-sensitive If TRUE, the files whose names differ only in case
1711
+** care considered distinct. If FALSE files whose names
1712
+** differ only in case are the same file. Defaults to
1713
+** TRUE for unix and FALSE for windows and mac.
17081714
**
17091715
** clearsign When enabled, fossil will attempt to sign all commits
17101716
** with gpg. When disabled (the default), commits will
17111717
** be unsigned. Default: off
17121718
**
17131719
--- src/db.c
+++ src/db.c
@@ -1366,19 +1366,19 @@
1366 */
1367 int is_truth(const char *zVal){
1368 static const char *azOn[] = { "on", "yes", "true", "1" };
1369 int i;
1370 for(i=0; i<sizeof(azOn)/sizeof(azOn[0]); i++){
1371 if( fossil_strcmp(zVal,azOn[i])==0 ) return 1;
1372 }
1373 return 0;
1374 }
1375 int is_false(const char *zVal){
1376 static const char *azOff[] = { "off", "no", "false", "0" };
1377 int i;
1378 for(i=0; i<sizeof(azOff)/sizeof(azOff[0]); i++){
1379 if( fossil_strcmp(zVal,azOff[i])==0 ) return 1;
1380 }
1381 return 0;
1382 }
1383
1384 /*
@@ -1647,10 +1647,11 @@
1647 { "access-log", 0, 0, "off" },
1648 { "auto-captcha", "autocaptcha", 0, "on" },
1649 { "auto-shun", 0, 0, "on" },
1650 { "autosync", 0, 0, "on" },
1651 { "binary-glob", 0, 32, "" },
 
1652 { "clearsign", 0, 0, "off" },
1653 { "crnl-glob", 0, 16, "" },
1654 { "default-perms", 0, 16, "u" },
1655 { "diff-command", 0, 16, "" },
1656 { "dont-push", 0, 0, "off" },
@@ -1703,10 +1704,15 @@
1703 ** Default: on
1704 **
1705 ** binary-glob The VALUE is a comma-separated list of GLOB patterns
1706 ** that should be treated as binary files for merging
1707 ** purposes. Example: *.xml
 
 
 
 
 
1708 **
1709 ** clearsign When enabled, fossil will attempt to sign all commits
1710 ** with gpg. When disabled (the default), commits will
1711 ** be unsigned. Default: off
1712 **
1713
--- src/db.c
+++ src/db.c
@@ -1366,19 +1366,19 @@
1366 */
1367 int is_truth(const char *zVal){
1368 static const char *azOn[] = { "on", "yes", "true", "1" };
1369 int i;
1370 for(i=0; i<sizeof(azOn)/sizeof(azOn[0]); i++){
1371 if( fossil_stricmp(zVal,azOn[i])==0 ) return 1;
1372 }
1373 return 0;
1374 }
1375 int is_false(const char *zVal){
1376 static const char *azOff[] = { "off", "no", "false", "0" };
1377 int i;
1378 for(i=0; i<sizeof(azOff)/sizeof(azOff[0]); i++){
1379 if( fossil_stricmp(zVal,azOff[i])==0 ) return 1;
1380 }
1381 return 0;
1382 }
1383
1384 /*
@@ -1647,10 +1647,11 @@
1647 { "access-log", 0, 0, "off" },
1648 { "auto-captcha", "autocaptcha", 0, "on" },
1649 { "auto-shun", 0, 0, "on" },
1650 { "autosync", 0, 0, "on" },
1651 { "binary-glob", 0, 32, "" },
1652 { "case-sensitive",0, 0, "on" },
1653 { "clearsign", 0, 0, "off" },
1654 { "crnl-glob", 0, 16, "" },
1655 { "default-perms", 0, 16, "u" },
1656 { "diff-command", 0, 16, "" },
1657 { "dont-push", 0, 0, "off" },
@@ -1703,10 +1704,15 @@
1704 ** Default: on
1705 **
1706 ** binary-glob The VALUE is a comma-separated list of GLOB patterns
1707 ** that should be treated as binary files for merging
1708 ** purposes. Example: *.xml
1709 **
1710 ** case-sensitive If TRUE, the files whose names differ only in case
1711 ** care considered distinct. If FALSE files whose names
1712 ** differ only in case are the same file. Defaults to
1713 ** TRUE for unix and FALSE for windows and mac.
1714 **
1715 ** clearsign When enabled, fossil will attempt to sign all commits
1716 ** with gpg. When disabled (the default), commits will
1717 ** be unsigned. Default: off
1718 **
1719
+10 -2
--- src/merge.c
+++ src/merge.c
@@ -53,10 +53,14 @@
5353
** and do not try to merge parallel changes. This
5454
** option overrides the "binary-glob" setting.
5555
**
5656
** --nochange | -n Dryrun: do not actually make any changes; just
5757
** show what would have happened.
58
+**
59
+** --case-sensitive BOOL Overwrite the case-sensitive setting. If false,
60
+** files whose names differ only in case are taken
61
+** to be the same file.
5862
*/
5963
void merge_cmd(void){
6064
int vid; /* Current version "V" */
6165
int mid; /* Version we are merging from "M" */
6266
int pid; /* The pivot version - most recent common ancestor P */
@@ -69,10 +73,11 @@
6973
int debugFlag; /* True if --debug is present */
7074
int nChng; /* Number of file name changes */
7175
int *aChng; /* An array of file name changes */
7276
int i; /* Loop counter */
7377
int nConflict = 0; /* Number of conflicts seen */
78
+ int caseSensitive; /* True for case-sensitive filenames */
7479
Stmt q;
7580
7681
7782
/* Notation:
7883
**
@@ -87,14 +92,16 @@
8792
backoutFlag = find_option("backout",0,0)!=0;
8893
debugFlag = find_option("debug",0,0)!=0;
8994
zBinGlob = find_option("binary",0,1);
9095
nochangeFlag = find_option("nochange","n",0)!=0;
9196
zPivot = find_option("baseline",0,1);
97
+ capture_case_sensitive_option();
9298
if( g.argc!=3 ){
9399
usage("VERSION");
94100
}
95101
db_must_be_within_tree();
102
+ caseSensitive = filenames_are_case_sensitive();
96103
if( zBinGlob==0 ) zBinGlob = db_get("binary-glob",0);
97104
vid = db_lget_int("checkout", 0);
98105
if( vid==0 ){
99106
fossil_fatal("nothing is checked out");
100107
}
@@ -150,11 +157,11 @@
150157
** in the current checkout, the pivot, and the version being merged.
151158
*/
152159
db_multi_exec(
153160
"DROP TABLE IF EXISTS fv;"
154161
"CREATE TEMP TABLE fv("
155
- " fn TEXT PRIMARY KEY," /* The filename */
162
+ " fn TEXT PRIMARY KEY COLLATE %s," /* The filename */
156163
" idv INTEGER," /* VFILE entry for current version */
157164
" idp INTEGER," /* VFILE entry for the pivot */
158165
" idm INTEGER," /* VFILE entry for version merging in */
159166
" chnged BOOLEAN," /* True if current version has been edited */
160167
" ridv INTEGER," /* Record ID for current version */
@@ -161,11 +168,12 @@
161168
" ridp INTEGER," /* Record ID for pivot */
162169
" ridm INTEGER," /* Record ID for merge */
163170
" isexe BOOLEAN," /* Execute permission enabled */
164171
" fnp TEXT," /* The filename in the pivot */
165172
" fnm TEXT" /* the filename in the merged version */
166
- ");"
173
+ ");",
174
+ caseSensitive ? "binary" : "nocase"
167175
);
168176
169177
/* Add files found in V
170178
*/
171179
db_multi_exec(
172180
--- src/merge.c
+++ src/merge.c
@@ -53,10 +53,14 @@
53 ** and do not try to merge parallel changes. This
54 ** option overrides the "binary-glob" setting.
55 **
56 ** --nochange | -n Dryrun: do not actually make any changes; just
57 ** show what would have happened.
 
 
 
 
58 */
59 void merge_cmd(void){
60 int vid; /* Current version "V" */
61 int mid; /* Version we are merging from "M" */
62 int pid; /* The pivot version - most recent common ancestor P */
@@ -69,10 +73,11 @@
69 int debugFlag; /* True if --debug is present */
70 int nChng; /* Number of file name changes */
71 int *aChng; /* An array of file name changes */
72 int i; /* Loop counter */
73 int nConflict = 0; /* Number of conflicts seen */
 
74 Stmt q;
75
76
77 /* Notation:
78 **
@@ -87,14 +92,16 @@
87 backoutFlag = find_option("backout",0,0)!=0;
88 debugFlag = find_option("debug",0,0)!=0;
89 zBinGlob = find_option("binary",0,1);
90 nochangeFlag = find_option("nochange","n",0)!=0;
91 zPivot = find_option("baseline",0,1);
 
92 if( g.argc!=3 ){
93 usage("VERSION");
94 }
95 db_must_be_within_tree();
 
96 if( zBinGlob==0 ) zBinGlob = db_get("binary-glob",0);
97 vid = db_lget_int("checkout", 0);
98 if( vid==0 ){
99 fossil_fatal("nothing is checked out");
100 }
@@ -150,11 +157,11 @@
150 ** in the current checkout, the pivot, and the version being merged.
151 */
152 db_multi_exec(
153 "DROP TABLE IF EXISTS fv;"
154 "CREATE TEMP TABLE fv("
155 " fn TEXT PRIMARY KEY," /* The filename */
156 " idv INTEGER," /* VFILE entry for current version */
157 " idp INTEGER," /* VFILE entry for the pivot */
158 " idm INTEGER," /* VFILE entry for version merging in */
159 " chnged BOOLEAN," /* True if current version has been edited */
160 " ridv INTEGER," /* Record ID for current version */
@@ -161,11 +168,12 @@
161 " ridp INTEGER," /* Record ID for pivot */
162 " ridm INTEGER," /* Record ID for merge */
163 " isexe BOOLEAN," /* Execute permission enabled */
164 " fnp TEXT," /* The filename in the pivot */
165 " fnm TEXT" /* the filename in the merged version */
166 ");"
 
167 );
168
169 /* Add files found in V
170 */
171 db_multi_exec(
172
--- src/merge.c
+++ src/merge.c
@@ -53,10 +53,14 @@
53 ** and do not try to merge parallel changes. This
54 ** option overrides the "binary-glob" setting.
55 **
56 ** --nochange | -n Dryrun: do not actually make any changes; just
57 ** show what would have happened.
58 **
59 ** --case-sensitive BOOL Overwrite the case-sensitive setting. If false,
60 ** files whose names differ only in case are taken
61 ** to be the same file.
62 */
63 void merge_cmd(void){
64 int vid; /* Current version "V" */
65 int mid; /* Version we are merging from "M" */
66 int pid; /* The pivot version - most recent common ancestor P */
@@ -69,10 +73,11 @@
73 int debugFlag; /* True if --debug is present */
74 int nChng; /* Number of file name changes */
75 int *aChng; /* An array of file name changes */
76 int i; /* Loop counter */
77 int nConflict = 0; /* Number of conflicts seen */
78 int caseSensitive; /* True for case-sensitive filenames */
79 Stmt q;
80
81
82 /* Notation:
83 **
@@ -87,14 +92,16 @@
92 backoutFlag = find_option("backout",0,0)!=0;
93 debugFlag = find_option("debug",0,0)!=0;
94 zBinGlob = find_option("binary",0,1);
95 nochangeFlag = find_option("nochange","n",0)!=0;
96 zPivot = find_option("baseline",0,1);
97 capture_case_sensitive_option();
98 if( g.argc!=3 ){
99 usage("VERSION");
100 }
101 db_must_be_within_tree();
102 caseSensitive = filenames_are_case_sensitive();
103 if( zBinGlob==0 ) zBinGlob = db_get("binary-glob",0);
104 vid = db_lget_int("checkout", 0);
105 if( vid==0 ){
106 fossil_fatal("nothing is checked out");
107 }
@@ -150,11 +157,11 @@
157 ** in the current checkout, the pivot, and the version being merged.
158 */
159 db_multi_exec(
160 "DROP TABLE IF EXISTS fv;"
161 "CREATE TEMP TABLE fv("
162 " fn TEXT PRIMARY KEY COLLATE %s," /* The filename */
163 " idv INTEGER," /* VFILE entry for current version */
164 " idp INTEGER," /* VFILE entry for the pivot */
165 " idm INTEGER," /* VFILE entry for version merging in */
166 " chnged BOOLEAN," /* True if current version has been edited */
167 " ridv INTEGER," /* Record ID for current version */
@@ -161,11 +168,12 @@
168 " ridp INTEGER," /* Record ID for pivot */
169 " ridm INTEGER," /* Record ID for merge */
170 " isexe BOOLEAN," /* Execute permission enabled */
171 " fnp TEXT," /* The filename in the pivot */
172 " fnm TEXT" /* the filename in the merged version */
173 ");",
174 caseSensitive ? "binary" : "nocase"
175 );
176
177 /* Add files found in V
178 */
179 db_multi_exec(
180

Keyboard Shortcuts

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