Fossil SCM

Automatically remove "all" entries that differ only in case on case-insensitive filesystems.

drh 2014-09-13 16:10 trunk merge
Commit c6079d148eb13b16265a6ec7c2f44abcf2fe2c33
1 file changed +26 -6
+26 -6
--- src/db.c
+++ src/db.c
@@ -1972,36 +1972,56 @@
19721972
** ckout:%s
19731973
**
19741974
** Where %s is the checkout root. The value is the repository file.
19751975
*/
19761976
void db_record_repository_filename(const char *zName){
1977
+ const char *zCollation;
1978
+ char *zRepoSetting;
1979
+ char *zCkoutSetting;
19771980
Blob full;
19781981
if( zName==0 ){
19791982
if( !g.localOpen ) return;
19801983
zName = db_repository_filename();
19811984
}
19821985
file_canonical_name(zName, &full, 0);
1986
+ zCollation = filename_collation();
19831987
db_swap_connections();
1988
+ zRepoSetting = mprintf("repo:%q", blob_str(&full));
1989
+ db_multi_exec(
1990
+ "DELETE FROM global_config WHERE name %s = '%s';",
1991
+ zCollation, zRepoSetting
1992
+ );
19841993
db_multi_exec(
19851994
"INSERT OR IGNORE INTO global_config(name,value)"
1986
- "VALUES('repo:%q',1)",
1987
- blob_str(&full)
1995
+ "VALUES('%s',1);",
1996
+ zRepoSetting
19881997
);
1998
+ fossil_free(zRepoSetting);
19891999
if( g.localOpen && g.zLocalRoot && g.zLocalRoot[0] ){
19902000
Blob localRoot;
19912001
file_canonical_name(g.zLocalRoot, &localRoot, 1);
2002
+ zCkoutSetting = mprintf("ckout:%q", blob_str(&localRoot));
2003
+ db_multi_exec(
2004
+ "DELETE FROM global_config WHERE name %s = '%s';",
2005
+ zCollation, zCkoutSetting
2006
+ );
19922007
db_multi_exec(
19932008
"REPLACE INTO global_config(name, value)"
1994
- "VALUES('ckout:%q','%q');",
1995
- blob_str(&localRoot), blob_str(&full)
2009
+ "VALUES('%s','%q');",
2010
+ zCkoutSetting, blob_str(&full)
19962011
);
19972012
db_swap_connections();
2013
+ db_optional_sql("repository",
2014
+ "DELETE FROM config WHERE name %s = '%s';",
2015
+ zCollation, zCkoutSetting
2016
+ );
19982017
db_optional_sql("repository",
19992018
"REPLACE INTO config(name,value,mtime)"
2000
- "VALUES('ckout:%q',1,now())",
2001
- blob_str(&localRoot)
2019
+ "VALUES('%s',1,now());",
2020
+ zCkoutSetting
20022021
);
2022
+ fossil_free(zCkoutSetting);
20032023
blob_reset(&localRoot);
20042024
}else{
20052025
db_swap_connections();
20062026
}
20072027
blob_reset(&full);
20082028
--- src/db.c
+++ src/db.c
@@ -1972,36 +1972,56 @@
1972 ** ckout:%s
1973 **
1974 ** Where %s is the checkout root. The value is the repository file.
1975 */
1976 void db_record_repository_filename(const char *zName){
 
 
 
1977 Blob full;
1978 if( zName==0 ){
1979 if( !g.localOpen ) return;
1980 zName = db_repository_filename();
1981 }
1982 file_canonical_name(zName, &full, 0);
 
1983 db_swap_connections();
 
 
 
 
 
1984 db_multi_exec(
1985 "INSERT OR IGNORE INTO global_config(name,value)"
1986 "VALUES('repo:%q',1)",
1987 blob_str(&full)
1988 );
 
1989 if( g.localOpen && g.zLocalRoot && g.zLocalRoot[0] ){
1990 Blob localRoot;
1991 file_canonical_name(g.zLocalRoot, &localRoot, 1);
 
 
 
 
 
1992 db_multi_exec(
1993 "REPLACE INTO global_config(name, value)"
1994 "VALUES('ckout:%q','%q');",
1995 blob_str(&localRoot), blob_str(&full)
1996 );
1997 db_swap_connections();
 
 
 
 
1998 db_optional_sql("repository",
1999 "REPLACE INTO config(name,value,mtime)"
2000 "VALUES('ckout:%q',1,now())",
2001 blob_str(&localRoot)
2002 );
 
2003 blob_reset(&localRoot);
2004 }else{
2005 db_swap_connections();
2006 }
2007 blob_reset(&full);
2008
--- src/db.c
+++ src/db.c
@@ -1972,36 +1972,56 @@
1972 ** ckout:%s
1973 **
1974 ** Where %s is the checkout root. The value is the repository file.
1975 */
1976 void db_record_repository_filename(const char *zName){
1977 const char *zCollation;
1978 char *zRepoSetting;
1979 char *zCkoutSetting;
1980 Blob full;
1981 if( zName==0 ){
1982 if( !g.localOpen ) return;
1983 zName = db_repository_filename();
1984 }
1985 file_canonical_name(zName, &full, 0);
1986 zCollation = filename_collation();
1987 db_swap_connections();
1988 zRepoSetting = mprintf("repo:%q", blob_str(&full));
1989 db_multi_exec(
1990 "DELETE FROM global_config WHERE name %s = '%s';",
1991 zCollation, zRepoSetting
1992 );
1993 db_multi_exec(
1994 "INSERT OR IGNORE INTO global_config(name,value)"
1995 "VALUES('%s',1);",
1996 zRepoSetting
1997 );
1998 fossil_free(zRepoSetting);
1999 if( g.localOpen && g.zLocalRoot && g.zLocalRoot[0] ){
2000 Blob localRoot;
2001 file_canonical_name(g.zLocalRoot, &localRoot, 1);
2002 zCkoutSetting = mprintf("ckout:%q", blob_str(&localRoot));
2003 db_multi_exec(
2004 "DELETE FROM global_config WHERE name %s = '%s';",
2005 zCollation, zCkoutSetting
2006 );
2007 db_multi_exec(
2008 "REPLACE INTO global_config(name, value)"
2009 "VALUES('%s','%q');",
2010 zCkoutSetting, blob_str(&full)
2011 );
2012 db_swap_connections();
2013 db_optional_sql("repository",
2014 "DELETE FROM config WHERE name %s = '%s';",
2015 zCollation, zCkoutSetting
2016 );
2017 db_optional_sql("repository",
2018 "REPLACE INTO config(name,value,mtime)"
2019 "VALUES('%s',1,now());",
2020 zCkoutSetting
2021 );
2022 fossil_free(zCkoutSetting);
2023 blob_reset(&localRoot);
2024 }else{
2025 db_swap_connections();
2026 }
2027 blob_reset(&full);
2028

Keyboard Shortcuts

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