Fossil SCM

Suggested fix for [85017e9273]

jan.nijtmans 2013-04-16 09:59 UTC trunk
Commit d0764530d329ae058832f5438f13ad7b25277f46
3 files changed +8 -8 +10 -2 +6 -3
+8 -8
--- src/add.c
+++ src/add.c
@@ -262,16 +262,16 @@
262262
if( vid==0 ){
263263
fossil_panic("no checkout to add to");
264264
}
265265
db_begin_transaction();
266266
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
267
-#if defined(_WIN32) || defined(__CYGWIN__)
268
- db_multi_exec(
269
- "CREATE INDEX IF NOT EXISTS vfile_pathname "
270
- " ON vfile(pathname COLLATE nocase)"
271
- );
272
-#endif
267
+ if( caseSensitive ){
268
+ db_multi_exec(
269
+ "CREATE INDEX IF NOT EXISTS vfile_pathname "
270
+ " ON vfile(pathname COLLATE nocase)"
271
+ );
272
+ }
273273
pIgnore = glob_create(zIgnoreFlag);
274274
nRoot = strlen(g.zLocalRoot);
275275
276276
/* Load the names of all files that are to be added into sfile temp table */
277277
for(i=2; i<g.argc; i++){
@@ -281,11 +281,11 @@
281281
282282
file_canonical_name(g.argv[i], &fullName, 0);
283283
zName = blob_str(&fullName);
284284
isDir = file_wd_isdir(zName);
285285
if( isDir==1 ){
286
- vfile_scan(&fullName, nRoot-1, scanFlags, pIgnore);
286
+ vfile_scan(&fullName, nRoot-1, scanFlags, pIgnore, caseSensitive);
287287
}else if( isDir==0 ){
288288
fossil_warning("not found: %s", zName);
289289
}else if( file_access(zName, R_OK) ){
290290
fossil_fatal("cannot open %s", zName);
291291
}else{
@@ -497,11 +497,11 @@
497497
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
498498
n = strlen(g.zLocalRoot);
499499
blob_init(&path, g.zLocalRoot, n-1);
500500
/* now we read the complete file structure into a temp table */
501501
pIgnore = glob_create(zIgnoreFlag);
502
- vfile_scan(&path, blob_size(&path), scanFlags, pIgnore);
502
+ vfile_scan(&path, blob_size(&path), scanFlags, pIgnore, caseSensitive);
503503
glob_free(pIgnore);
504504
nAdd = add_files_in_sfile(vid, caseSensitive);
505505
506506
/* step 2: search for missing files */
507507
db_prepare(&q,
508508
--- src/add.c
+++ src/add.c
@@ -262,16 +262,16 @@
262 if( vid==0 ){
263 fossil_panic("no checkout to add to");
264 }
265 db_begin_transaction();
266 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
267 #if defined(_WIN32) || defined(__CYGWIN__)
268 db_multi_exec(
269 "CREATE INDEX IF NOT EXISTS vfile_pathname "
270 " ON vfile(pathname COLLATE nocase)"
271 );
272 #endif
273 pIgnore = glob_create(zIgnoreFlag);
274 nRoot = strlen(g.zLocalRoot);
275
276 /* Load the names of all files that are to be added into sfile temp table */
277 for(i=2; i<g.argc; i++){
@@ -281,11 +281,11 @@
281
282 file_canonical_name(g.argv[i], &fullName, 0);
283 zName = blob_str(&fullName);
284 isDir = file_wd_isdir(zName);
285 if( isDir==1 ){
286 vfile_scan(&fullName, nRoot-1, scanFlags, pIgnore);
287 }else if( isDir==0 ){
288 fossil_warning("not found: %s", zName);
289 }else if( file_access(zName, R_OK) ){
290 fossil_fatal("cannot open %s", zName);
291 }else{
@@ -497,11 +497,11 @@
497 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
498 n = strlen(g.zLocalRoot);
499 blob_init(&path, g.zLocalRoot, n-1);
500 /* now we read the complete file structure into a temp table */
501 pIgnore = glob_create(zIgnoreFlag);
502 vfile_scan(&path, blob_size(&path), scanFlags, pIgnore);
503 glob_free(pIgnore);
504 nAdd = add_files_in_sfile(vid, caseSensitive);
505
506 /* step 2: search for missing files */
507 db_prepare(&q,
508
--- src/add.c
+++ src/add.c
@@ -262,16 +262,16 @@
262 if( vid==0 ){
263 fossil_panic("no checkout to add to");
264 }
265 db_begin_transaction();
266 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
267 if( caseSensitive ){
268 db_multi_exec(
269 "CREATE INDEX IF NOT EXISTS vfile_pathname "
270 " ON vfile(pathname COLLATE nocase)"
271 );
272 }
273 pIgnore = glob_create(zIgnoreFlag);
274 nRoot = strlen(g.zLocalRoot);
275
276 /* Load the names of all files that are to be added into sfile temp table */
277 for(i=2; i<g.argc; i++){
@@ -281,11 +281,11 @@
281
282 file_canonical_name(g.argv[i], &fullName, 0);
283 zName = blob_str(&fullName);
284 isDir = file_wd_isdir(zName);
285 if( isDir==1 ){
286 vfile_scan(&fullName, nRoot-1, scanFlags, pIgnore, caseSensitive);
287 }else if( isDir==0 ){
288 fossil_warning("not found: %s", zName);
289 }else if( file_access(zName, R_OK) ){
290 fossil_fatal("cannot open %s", zName);
291 }else{
@@ -497,11 +497,11 @@
497 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
498 n = strlen(g.zLocalRoot);
499 blob_init(&path, g.zLocalRoot, n-1);
500 /* now we read the complete file structure into a temp table */
501 pIgnore = glob_create(zIgnoreFlag);
502 vfile_scan(&path, blob_size(&path), scanFlags, pIgnore, caseSensitive);
503 glob_free(pIgnore);
504 nAdd = add_files_in_sfile(vid, caseSensitive);
505
506 /* step 2: search for missing files */
507 db_prepare(&q,
508
+10 -2
--- src/checkin.c
+++ src/checkin.c
@@ -314,10 +314,11 @@
314314
** Pathnames are displayed according to the "relative-paths" setting,
315315
** unless overridden by the --abs-paths or --rel-paths options.
316316
**
317317
** Options:
318318
** --abs-paths Display absolute pathnames.
319
+** --case-sensitive <BOOL> override case-sensitive setting
319320
** --dotfiles include files beginning with a dot (".")
320321
** --ignore <CSG> ignore files matching patterns from the argument
321322
** --rel-paths Display pathnames relative to the current working
322323
** directory.
323324
**
@@ -331,23 +332,26 @@
331332
unsigned scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0;
332333
int cwdRelative = 0;
333334
Glob *pIgnore;
334335
Blob rewrittenPathname;
335336
const char *zPathname, *zDisplayName;
337
+ int caseSensitive;
336338
337339
if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
340
+ capture_case_sensitive_option();
338341
db_must_be_within_tree();
342
+ caseSensitive = filenames_are_case_sensitive();
339343
cwdRelative = determine_cwd_relative_option();
340344
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
341345
filename_collation());
342346
n = strlen(g.zLocalRoot);
343347
blob_init(&path, g.zLocalRoot, n-1);
344348
if( zIgnoreFlag==0 ){
345349
zIgnoreFlag = db_get("ignore-glob", 0);
346350
}
347351
pIgnore = glob_create(zIgnoreFlag);
348
- vfile_scan(&path, blob_size(&path), scanFlags, pIgnore);
352
+ vfile_scan(&path, blob_size(&path), scanFlags, pIgnore, caseSensitive);
349353
glob_free(pIgnore);
350354
db_prepare(&q,
351355
"SELECT x FROM sfile"
352356
" WHERE x NOT IN (%s)"
353357
" ORDER BY 1",
@@ -391,10 +395,11 @@
391395
** The GLOBPATTERN is a comma-separated list of GLOB expressions for
392396
** files that are ignored. The GLOBPATTERN specified by the "ignore-glob"
393397
** is used if the --ignore option is omitted.
394398
**
395399
** Options:
400
+** --case-sensitive <BOOL> override case-sensitive setting
396401
** --dotfiles include files beginning with a dot (".")
397402
** --force Remove files without prompting
398403
** --ignore <CSG> ignore files matching patterns from the
399404
** comma separated list of glob patterns.
400405
** --temp Remove only Fossil-generated temporary files
@@ -408,26 +413,29 @@
408413
Blob path, repo;
409414
Stmt q;
410415
int n;
411416
Glob *pIgnore;
412417
int testFlag = 0;
418
+ int caseSensitive;
413419
414420
allFlag = find_option("force","f",0)!=0;
415421
if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
416422
if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
417423
zIgnoreFlag = find_option("ignore",0,1);
418424
testFlag = find_option("test",0,0)!=0;
425
+ capture_case_sensitive_option();
419426
db_must_be_within_tree();
427
+ caseSensitive = filenames_are_case_sensitive();
420428
if( zIgnoreFlag==0 ){
421429
zIgnoreFlag = db_get("ignore-glob", 0);
422430
}
423431
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
424432
filename_collation());
425433
n = strlen(g.zLocalRoot);
426434
blob_init(&path, g.zLocalRoot, n-1);
427435
pIgnore = glob_create(zIgnoreFlag);
428
- vfile_scan(&path, blob_size(&path), scanFlags, pIgnore);
436
+ vfile_scan(&path, blob_size(&path), scanFlags, pIgnore, caseSensitive);
429437
glob_free(pIgnore);
430438
db_prepare(&q,
431439
"SELECT %Q || x FROM sfile"
432440
" WHERE x NOT IN (%s)"
433441
" ORDER BY 1",
434442
--- src/checkin.c
+++ src/checkin.c
@@ -314,10 +314,11 @@
314 ** Pathnames are displayed according to the "relative-paths" setting,
315 ** unless overridden by the --abs-paths or --rel-paths options.
316 **
317 ** Options:
318 ** --abs-paths Display absolute pathnames.
 
319 ** --dotfiles include files beginning with a dot (".")
320 ** --ignore <CSG> ignore files matching patterns from the argument
321 ** --rel-paths Display pathnames relative to the current working
322 ** directory.
323 **
@@ -331,23 +332,26 @@
331 unsigned scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0;
332 int cwdRelative = 0;
333 Glob *pIgnore;
334 Blob rewrittenPathname;
335 const char *zPathname, *zDisplayName;
 
336
337 if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
 
338 db_must_be_within_tree();
 
339 cwdRelative = determine_cwd_relative_option();
340 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
341 filename_collation());
342 n = strlen(g.zLocalRoot);
343 blob_init(&path, g.zLocalRoot, n-1);
344 if( zIgnoreFlag==0 ){
345 zIgnoreFlag = db_get("ignore-glob", 0);
346 }
347 pIgnore = glob_create(zIgnoreFlag);
348 vfile_scan(&path, blob_size(&path), scanFlags, pIgnore);
349 glob_free(pIgnore);
350 db_prepare(&q,
351 "SELECT x FROM sfile"
352 " WHERE x NOT IN (%s)"
353 " ORDER BY 1",
@@ -391,10 +395,11 @@
391 ** The GLOBPATTERN is a comma-separated list of GLOB expressions for
392 ** files that are ignored. The GLOBPATTERN specified by the "ignore-glob"
393 ** is used if the --ignore option is omitted.
394 **
395 ** Options:
 
396 ** --dotfiles include files beginning with a dot (".")
397 ** --force Remove files without prompting
398 ** --ignore <CSG> ignore files matching patterns from the
399 ** comma separated list of glob patterns.
400 ** --temp Remove only Fossil-generated temporary files
@@ -408,26 +413,29 @@
408 Blob path, repo;
409 Stmt q;
410 int n;
411 Glob *pIgnore;
412 int testFlag = 0;
 
413
414 allFlag = find_option("force","f",0)!=0;
415 if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
416 if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
417 zIgnoreFlag = find_option("ignore",0,1);
418 testFlag = find_option("test",0,0)!=0;
 
419 db_must_be_within_tree();
 
420 if( zIgnoreFlag==0 ){
421 zIgnoreFlag = db_get("ignore-glob", 0);
422 }
423 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
424 filename_collation());
425 n = strlen(g.zLocalRoot);
426 blob_init(&path, g.zLocalRoot, n-1);
427 pIgnore = glob_create(zIgnoreFlag);
428 vfile_scan(&path, blob_size(&path), scanFlags, pIgnore);
429 glob_free(pIgnore);
430 db_prepare(&q,
431 "SELECT %Q || x FROM sfile"
432 " WHERE x NOT IN (%s)"
433 " ORDER BY 1",
434
--- src/checkin.c
+++ src/checkin.c
@@ -314,10 +314,11 @@
314 ** Pathnames are displayed according to the "relative-paths" setting,
315 ** unless overridden by the --abs-paths or --rel-paths options.
316 **
317 ** Options:
318 ** --abs-paths Display absolute pathnames.
319 ** --case-sensitive <BOOL> override case-sensitive setting
320 ** --dotfiles include files beginning with a dot (".")
321 ** --ignore <CSG> ignore files matching patterns from the argument
322 ** --rel-paths Display pathnames relative to the current working
323 ** directory.
324 **
@@ -331,23 +332,26 @@
332 unsigned scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0;
333 int cwdRelative = 0;
334 Glob *pIgnore;
335 Blob rewrittenPathname;
336 const char *zPathname, *zDisplayName;
337 int caseSensitive;
338
339 if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
340 capture_case_sensitive_option();
341 db_must_be_within_tree();
342 caseSensitive = filenames_are_case_sensitive();
343 cwdRelative = determine_cwd_relative_option();
344 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
345 filename_collation());
346 n = strlen(g.zLocalRoot);
347 blob_init(&path, g.zLocalRoot, n-1);
348 if( zIgnoreFlag==0 ){
349 zIgnoreFlag = db_get("ignore-glob", 0);
350 }
351 pIgnore = glob_create(zIgnoreFlag);
352 vfile_scan(&path, blob_size(&path), scanFlags, pIgnore, caseSensitive);
353 glob_free(pIgnore);
354 db_prepare(&q,
355 "SELECT x FROM sfile"
356 " WHERE x NOT IN (%s)"
357 " ORDER BY 1",
@@ -391,10 +395,11 @@
395 ** The GLOBPATTERN is a comma-separated list of GLOB expressions for
396 ** files that are ignored. The GLOBPATTERN specified by the "ignore-glob"
397 ** is used if the --ignore option is omitted.
398 **
399 ** Options:
400 ** --case-sensitive <BOOL> override case-sensitive setting
401 ** --dotfiles include files beginning with a dot (".")
402 ** --force Remove files without prompting
403 ** --ignore <CSG> ignore files matching patterns from the
404 ** comma separated list of glob patterns.
405 ** --temp Remove only Fossil-generated temporary files
@@ -408,26 +413,29 @@
413 Blob path, repo;
414 Stmt q;
415 int n;
416 Glob *pIgnore;
417 int testFlag = 0;
418 int caseSensitive;
419
420 allFlag = find_option("force","f",0)!=0;
421 if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
422 if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
423 zIgnoreFlag = find_option("ignore",0,1);
424 testFlag = find_option("test",0,0)!=0;
425 capture_case_sensitive_option();
426 db_must_be_within_tree();
427 caseSensitive = filenames_are_case_sensitive();
428 if( zIgnoreFlag==0 ){
429 zIgnoreFlag = db_get("ignore-glob", 0);
430 }
431 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
432 filename_collation());
433 n = strlen(g.zLocalRoot);
434 blob_init(&path, g.zLocalRoot, n-1);
435 pIgnore = glob_create(zIgnoreFlag);
436 vfile_scan(&path, blob_size(&path), scanFlags, pIgnore, caseSensitive);
437 glob_free(pIgnore);
438 db_prepare(&q,
439 "SELECT %Q || x FROM sfile"
440 " WHERE x NOT IN (%s)"
441 " ORDER BY 1",
442
+6 -3
--- src/vfile.c
+++ src/vfile.c
@@ -432,19 +432,21 @@
432432
**
433433
** Any files or directories that match the glob pattern pIgnore are
434434
** excluded from the scan. Name matching occurs after the first
435435
** nPrefix characters are elided from the filename.
436436
*/
437
-void vfile_scan(Blob *pPath, int nPrefix, unsigned scanFlags, Glob *pIgnore){
437
+void vfile_scan(Blob *pPath, int nPrefix, unsigned scanFlags, Glob *pIgnore,
438
+ int caseSensitive){
438439
DIR *d;
439440
int origSize;
440441
const char *zDir;
441442
struct dirent *pEntry;
442443
int skipAll = 0;
443444
static Stmt ins;
444445
static int depth = 0;
445446
void *zNative;
447
+ const char *zCollate = caseSensitive ? "binary" : "nocase";
446448
447449
origSize = blob_size(pPath);
448450
if( pIgnore ){
449451
blob_appendf(pPath, "/");
450452
if( glob_match(pIgnore, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
@@ -453,11 +455,12 @@
453455
if( skipAll ) return;
454456
455457
if( depth==0 ){
456458
db_prepare(&ins,
457459
"INSERT OR IGNORE INTO sfile(x) SELECT :file"
458
- " WHERE NOT EXISTS(SELECT 1 FROM vfile WHERE pathname=:file)"
460
+ " WHERE NOT EXISTS(SELECT 1 FROM vfile WHERE"
461
+ " pathname=:file COLLATE %s)", zCollate
459462
);
460463
}
461464
depth++;
462465
463466
zDir = blob_str(pPath);
@@ -477,11 +480,11 @@
477480
zPath = blob_str(pPath);
478481
if( glob_match(pIgnore, &zPath[nPrefix+1]) ){
479482
/* do nothing */
480483
}else if( file_wd_isdir(zPath)==1 ){
481484
if( !vfile_top_of_checkout(zPath) ){
482
- vfile_scan(pPath, nPrefix, scanFlags, pIgnore);
485
+ vfile_scan(pPath, nPrefix, scanFlags, pIgnore, caseSensitive);
483486
}
484487
}else if( file_wd_isfile_or_link(zPath) ){
485488
if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(zUtf8) ){
486489
db_bind_text(&ins, ":file", &zPath[nPrefix+1]);
487490
db_step(&ins);
488491
--- src/vfile.c
+++ src/vfile.c
@@ -432,19 +432,21 @@
432 **
433 ** Any files or directories that match the glob pattern pIgnore are
434 ** excluded from the scan. Name matching occurs after the first
435 ** nPrefix characters are elided from the filename.
436 */
437 void vfile_scan(Blob *pPath, int nPrefix, unsigned scanFlags, Glob *pIgnore){
 
438 DIR *d;
439 int origSize;
440 const char *zDir;
441 struct dirent *pEntry;
442 int skipAll = 0;
443 static Stmt ins;
444 static int depth = 0;
445 void *zNative;
 
446
447 origSize = blob_size(pPath);
448 if( pIgnore ){
449 blob_appendf(pPath, "/");
450 if( glob_match(pIgnore, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
@@ -453,11 +455,12 @@
453 if( skipAll ) return;
454
455 if( depth==0 ){
456 db_prepare(&ins,
457 "INSERT OR IGNORE INTO sfile(x) SELECT :file"
458 " WHERE NOT EXISTS(SELECT 1 FROM vfile WHERE pathname=:file)"
 
459 );
460 }
461 depth++;
462
463 zDir = blob_str(pPath);
@@ -477,11 +480,11 @@
477 zPath = blob_str(pPath);
478 if( glob_match(pIgnore, &zPath[nPrefix+1]) ){
479 /* do nothing */
480 }else if( file_wd_isdir(zPath)==1 ){
481 if( !vfile_top_of_checkout(zPath) ){
482 vfile_scan(pPath, nPrefix, scanFlags, pIgnore);
483 }
484 }else if( file_wd_isfile_or_link(zPath) ){
485 if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(zUtf8) ){
486 db_bind_text(&ins, ":file", &zPath[nPrefix+1]);
487 db_step(&ins);
488
--- src/vfile.c
+++ src/vfile.c
@@ -432,19 +432,21 @@
432 **
433 ** Any files or directories that match the glob pattern pIgnore are
434 ** excluded from the scan. Name matching occurs after the first
435 ** nPrefix characters are elided from the filename.
436 */
437 void vfile_scan(Blob *pPath, int nPrefix, unsigned scanFlags, Glob *pIgnore,
438 int caseSensitive){
439 DIR *d;
440 int origSize;
441 const char *zDir;
442 struct dirent *pEntry;
443 int skipAll = 0;
444 static Stmt ins;
445 static int depth = 0;
446 void *zNative;
447 const char *zCollate = caseSensitive ? "binary" : "nocase";
448
449 origSize = blob_size(pPath);
450 if( pIgnore ){
451 blob_appendf(pPath, "/");
452 if( glob_match(pIgnore, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
@@ -453,11 +455,12 @@
455 if( skipAll ) return;
456
457 if( depth==0 ){
458 db_prepare(&ins,
459 "INSERT OR IGNORE INTO sfile(x) SELECT :file"
460 " WHERE NOT EXISTS(SELECT 1 FROM vfile WHERE"
461 " pathname=:file COLLATE %s)", zCollate
462 );
463 }
464 depth++;
465
466 zDir = blob_str(pPath);
@@ -477,11 +480,11 @@
480 zPath = blob_str(pPath);
481 if( glob_match(pIgnore, &zPath[nPrefix+1]) ){
482 /* do nothing */
483 }else if( file_wd_isdir(zPath)==1 ){
484 if( !vfile_top_of_checkout(zPath) ){
485 vfile_scan(pPath, nPrefix, scanFlags, pIgnore, caseSensitive);
486 }
487 }else if( file_wd_isfile_or_link(zPath) ){
488 if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(zUtf8) ){
489 db_bind_text(&ins, ":file", &zPath[nPrefix+1]);
490 db_step(&ins);
491

Keyboard Shortcuts

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