Index: src/add.c ================================================================== --- src/add.c +++ src/add.c @@ -262,16 +262,16 @@ if( vid==0 ){ fossil_panic("no checkout to add to"); } db_begin_transaction(); db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)"); -#if defined(_WIN32) || defined(__CYGWIN__) - db_multi_exec( - "CREATE INDEX IF NOT EXISTS vfile_pathname " - " ON vfile(pathname COLLATE nocase)" - ); -#endif + if( caseSensitive ){ + db_multi_exec( + "CREATE INDEX IF NOT EXISTS vfile_pathname " + " ON vfile(pathname COLLATE nocase)" + ); + } pIgnore = glob_create(zIgnoreFlag); nRoot = strlen(g.zLocalRoot); /* Load the names of all files that are to be added into sfile temp table */ for(i=2; i override case-sensitive setting ** --dotfiles include files beginning with a dot (".") ** --ignore ignore files matching patterns from the argument ** --rel-paths Display pathnames relative to the current working ** directory. ** @@ -331,23 +332,26 @@ unsigned scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0; int cwdRelative = 0; Glob *pIgnore; Blob rewrittenPathname; const char *zPathname, *zDisplayName; + int caseSensitive; if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP; + capture_case_sensitive_option(); db_must_be_within_tree(); + caseSensitive = filenames_are_case_sensitive(); cwdRelative = determine_cwd_relative_option(); db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)", filename_collation()); n = strlen(g.zLocalRoot); blob_init(&path, g.zLocalRoot, n-1); if( zIgnoreFlag==0 ){ zIgnoreFlag = db_get("ignore-glob", 0); } pIgnore = glob_create(zIgnoreFlag); - vfile_scan(&path, blob_size(&path), scanFlags, pIgnore); + vfile_scan(&path, blob_size(&path), scanFlags, pIgnore, caseSensitive); glob_free(pIgnore); db_prepare(&q, "SELECT x FROM sfile" " WHERE x NOT IN (%s)" " ORDER BY 1", @@ -391,10 +395,11 @@ ** The GLOBPATTERN is a comma-separated list of GLOB expressions for ** files that are ignored. The GLOBPATTERN specified by the "ignore-glob" ** is used if the --ignore option is omitted. ** ** Options: +** --case-sensitive override case-sensitive setting ** --dotfiles include files beginning with a dot (".") ** --force Remove files without prompting ** --ignore ignore files matching patterns from the ** comma separated list of glob patterns. ** --temp Remove only Fossil-generated temporary files @@ -408,26 +413,29 @@ Blob path, repo; Stmt q; int n; Glob *pIgnore; int testFlag = 0; + int caseSensitive; allFlag = find_option("force","f",0)!=0; if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP; zIgnoreFlag = find_option("ignore",0,1); testFlag = find_option("test",0,0)!=0; + capture_case_sensitive_option(); db_must_be_within_tree(); + caseSensitive = filenames_are_case_sensitive(); if( zIgnoreFlag==0 ){ zIgnoreFlag = db_get("ignore-glob", 0); } db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)", filename_collation()); n = strlen(g.zLocalRoot); blob_init(&path, g.zLocalRoot, n-1); pIgnore = glob_create(zIgnoreFlag); - vfile_scan(&path, blob_size(&path), scanFlags, pIgnore); + vfile_scan(&path, blob_size(&path), scanFlags, pIgnore, caseSensitive); glob_free(pIgnore); db_prepare(&q, "SELECT %Q || x FROM sfile" " WHERE x NOT IN (%s)" " ORDER BY 1", Index: src/vfile.c ================================================================== --- src/vfile.c +++ src/vfile.c @@ -432,19 +432,21 @@ ** ** Any files or directories that match the glob pattern pIgnore are ** excluded from the scan. Name matching occurs after the first ** nPrefix characters are elided from the filename. */ -void vfile_scan(Blob *pPath, int nPrefix, unsigned scanFlags, Glob *pIgnore){ +void vfile_scan(Blob *pPath, int nPrefix, unsigned scanFlags, Glob *pIgnore, + int caseSensitive){ DIR *d; int origSize; const char *zDir; struct dirent *pEntry; int skipAll = 0; static Stmt ins; static int depth = 0; void *zNative; + const char *zCollate = caseSensitive ? "binary" : "nocase"; origSize = blob_size(pPath); if( pIgnore ){ blob_appendf(pPath, "/"); if( glob_match(pIgnore, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1; @@ -453,11 +455,12 @@ if( skipAll ) return; if( depth==0 ){ db_prepare(&ins, "INSERT OR IGNORE INTO sfile(x) SELECT :file" - " WHERE NOT EXISTS(SELECT 1 FROM vfile WHERE pathname=:file)" + " WHERE NOT EXISTS(SELECT 1 FROM vfile WHERE" + " pathname=:file COLLATE %s)", zCollate ); } depth++; zDir = blob_str(pPath); @@ -477,11 +480,11 @@ zPath = blob_str(pPath); if( glob_match(pIgnore, &zPath[nPrefix+1]) ){ /* do nothing */ }else if( file_wd_isdir(zPath)==1 ){ if( !vfile_top_of_checkout(zPath) ){ - vfile_scan(pPath, nPrefix, scanFlags, pIgnore); + vfile_scan(pPath, nPrefix, scanFlags, pIgnore, caseSensitive); } }else if( file_wd_isfile_or_link(zPath) ){ if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(zUtf8) ){ db_bind_text(&ins, ":file", &zPath[nPrefix+1]); db_step(&ins);