Fossil SCM

On windows, do not allow the "add" command to add files that differ from existing files only in case. Only works for ASCII. Ticket [36cb6b45fd9d].

drh 2010-01-20 18:35 trunk
Commit 4b9455bf03c38546c1adc49f5a03bd2eba096969
1 file changed +14 -1
+14 -1
--- src/add.c
+++ src/add.c
@@ -52,13 +52,20 @@
5252
fossil_warning("cannot add %s", zPath);
5353
}else{
5454
if( !file_is_simple_pathname(zPath) ){
5555
fossil_fatal("filename contains illegal characters: %s", zPath);
5656
}
57
+#ifdef __MINGW32__
58
+ if( db_exists("SELECT 1 FROM vfile WHERE pathname LIKE %Q", zPath) ){
59
+ db_multi_exec("UPDATE vfile SET deleted=0 WHERE pathname LIKE %Q", zPath);
60
+ }
61
+#else
5762
if( db_exists("SELECT 1 FROM vfile WHERE pathname=%Q", zPath) ){
5863
db_multi_exec("UPDATE vfile SET deleted=0 WHERE pathname=%Q", zPath);
59
- }else{
64
+ }
65
+#endif
66
+ else{
6067
db_multi_exec(
6168
"INSERT INTO vfile(vid,deleted,rid,mrid,pathname)"
6269
"VALUES(%d,0,0,0,%Q)", vid, zPath);
6370
}
6471
printf("ADDED %s\n", zPath);
@@ -142,10 +149,16 @@
142149
db_begin_transaction();
143150
if( !file_tree_name(g.zRepositoryName, &repo, 0) ){
144151
blob_zero(&repo);
145152
}
146153
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
154
+#ifdef __MINGW32__
155
+ db_multi_exec(
156
+ "CREATE INDEX IF NOT EXISTS vfile_pathname "
157
+ " ON vfile(pathname COLLATE nocase)"
158
+ );
159
+#endif
147160
for(i=2; i<g.argc; i++){
148161
char *zName;
149162
int isDir;
150163
151164
zName = mprintf("%/", g.argv[i]);
152165
--- src/add.c
+++ src/add.c
@@ -52,13 +52,20 @@
52 fossil_warning("cannot add %s", zPath);
53 }else{
54 if( !file_is_simple_pathname(zPath) ){
55 fossil_fatal("filename contains illegal characters: %s", zPath);
56 }
 
 
 
 
 
57 if( db_exists("SELECT 1 FROM vfile WHERE pathname=%Q", zPath) ){
58 db_multi_exec("UPDATE vfile SET deleted=0 WHERE pathname=%Q", zPath);
59 }else{
 
 
60 db_multi_exec(
61 "INSERT INTO vfile(vid,deleted,rid,mrid,pathname)"
62 "VALUES(%d,0,0,0,%Q)", vid, zPath);
63 }
64 printf("ADDED %s\n", zPath);
@@ -142,10 +149,16 @@
142 db_begin_transaction();
143 if( !file_tree_name(g.zRepositoryName, &repo, 0) ){
144 blob_zero(&repo);
145 }
146 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
 
 
 
 
 
 
147 for(i=2; i<g.argc; i++){
148 char *zName;
149 int isDir;
150
151 zName = mprintf("%/", g.argv[i]);
152
--- src/add.c
+++ src/add.c
@@ -52,13 +52,20 @@
52 fossil_warning("cannot add %s", zPath);
53 }else{
54 if( !file_is_simple_pathname(zPath) ){
55 fossil_fatal("filename contains illegal characters: %s", zPath);
56 }
57 #ifdef __MINGW32__
58 if( db_exists("SELECT 1 FROM vfile WHERE pathname LIKE %Q", zPath) ){
59 db_multi_exec("UPDATE vfile SET deleted=0 WHERE pathname LIKE %Q", zPath);
60 }
61 #else
62 if( db_exists("SELECT 1 FROM vfile WHERE pathname=%Q", zPath) ){
63 db_multi_exec("UPDATE vfile SET deleted=0 WHERE pathname=%Q", zPath);
64 }
65 #endif
66 else{
67 db_multi_exec(
68 "INSERT INTO vfile(vid,deleted,rid,mrid,pathname)"
69 "VALUES(%d,0,0,0,%Q)", vid, zPath);
70 }
71 printf("ADDED %s\n", zPath);
@@ -142,10 +149,16 @@
149 db_begin_transaction();
150 if( !file_tree_name(g.zRepositoryName, &repo, 0) ){
151 blob_zero(&repo);
152 }
153 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
154 #ifdef __MINGW32__
155 db_multi_exec(
156 "CREATE INDEX IF NOT EXISTS vfile_pathname "
157 " ON vfile(pathname COLLATE nocase)"
158 );
159 #endif
160 for(i=2; i<g.argc; i++){
161 char *zName;
162 int isDir;
163
164 zName = mprintf("%/", g.argv[i]);
165

Keyboard Shortcuts

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