Fossil SCM

The finfo command and the file browsing pages of the web UI now honor the case-sensitive option and merge filenames that differ only in case as requested.

drh 2011-12-06 00:09 trunk
Commit 9c90b0f0522c2fc3b8842f459bea910d7f8417c6
+22 -7
--- src/add.c
+++ src/add.c
@@ -337,24 +337,39 @@
337337
**
338338
** The --case-sensitive BOOLEAN command-line option overrides any
339339
** setting.
340340
*/
341341
int filenames_are_case_sensitive(void){
342
- int caseSensitive;
342
+ static int caseSensitive;
343
+ static int once = 1;
343344
344
- if( zCaseSensitive ){
345
- caseSensitive = is_truth(zCaseSensitive);
346
- }else{
345
+ if( once ){
346
+ once = 0;
347
+ if( zCaseSensitive ){
348
+ caseSensitive = is_truth(zCaseSensitive);
349
+ }else{
347350
#if !defined(_WIN32) && !defined(__DARWIN__) && !defined(__APPLE__)
348
- caseSensitive = 1;
351
+ caseSensitive = 1; /* Unix */
349352
#else
350
- caseSensitive = 0;
353
+ caseSensitive = 0; /* Windows and Mac */
351354
#endif
352
- caseSensitive = db_get_boolean("case-sensitive",caseSensitive);
355
+ caseSensitive = db_get_boolean("case-sensitive",caseSensitive);
356
+ }
353357
}
354358
return caseSensitive;
355359
}
360
+
361
+/*
362
+** Return one of two things:
363
+**
364
+** "" (empty string) if filenames are case sensitive
365
+**
366
+** "COLLATE nocase" if filenames are not case sensitive.
367
+*/
368
+const char *filename_collation(void){
369
+ return filenames_are_case_sensitive() ? "" : "COLLATE nocase";
370
+}
356371
357372
/*
358373
** COMMAND: addremove
359374
**
360375
** Usage: %fossil addremove ?OPTIONS?
361376
--- src/add.c
+++ src/add.c
@@ -337,24 +337,39 @@
337 **
338 ** The --case-sensitive BOOLEAN command-line option overrides any
339 ** setting.
340 */
341 int filenames_are_case_sensitive(void){
342 int caseSensitive;
 
343
344 if( zCaseSensitive ){
345 caseSensitive = is_truth(zCaseSensitive);
346 }else{
 
 
347 #if !defined(_WIN32) && !defined(__DARWIN__) && !defined(__APPLE__)
348 caseSensitive = 1;
349 #else
350 caseSensitive = 0;
351 #endif
352 caseSensitive = db_get_boolean("case-sensitive",caseSensitive);
 
353 }
354 return caseSensitive;
355 }
 
 
 
 
 
 
 
 
 
 
 
356
357 /*
358 ** COMMAND: addremove
359 **
360 ** Usage: %fossil addremove ?OPTIONS?
361
--- src/add.c
+++ src/add.c
@@ -337,24 +337,39 @@
337 **
338 ** The --case-sensitive BOOLEAN command-line option overrides any
339 ** setting.
340 */
341 int filenames_are_case_sensitive(void){
342 static int caseSensitive;
343 static int once = 1;
344
345 if( once ){
346 once = 0;
347 if( zCaseSensitive ){
348 caseSensitive = is_truth(zCaseSensitive);
349 }else{
350 #if !defined(_WIN32) && !defined(__DARWIN__) && !defined(__APPLE__)
351 caseSensitive = 1; /* Unix */
352 #else
353 caseSensitive = 0; /* Windows and Mac */
354 #endif
355 caseSensitive = db_get_boolean("case-sensitive",caseSensitive);
356 }
357 }
358 return caseSensitive;
359 }
360
361 /*
362 ** Return one of two things:
363 **
364 ** "" (empty string) if filenames are case sensitive
365 **
366 ** "COLLATE nocase" if filenames are not case sensitive.
367 */
368 const char *filename_collation(void){
369 return filenames_are_case_sensitive() ? "" : "COLLATE nocase";
370 }
371
372 /*
373 ** COMMAND: addremove
374 **
375 ** Usage: %fossil addremove ?OPTIONS?
376
+17 -7
--- src/browse.c
+++ src/browse.c
@@ -196,11 +196,12 @@
196196
** Subdirectory names begin with "/". This causes them to sort
197197
** first and it also gives us an easy way to distinguish files
198198
** from directories in the loop that follows.
199199
*/
200200
db_multi_exec(
201
- "CREATE TEMP TABLE localfiles(x UNIQUE NOT NULL, u);"
201
+ "CREATE TEMP TABLE localfiles(x UNIQUE NOT NULL %s, u);",
202
+ filename_collation()
202203
);
203204
if( zCI ){
204205
Stmt ins;
205206
ManifestFile *pFile;
206207
ManifestFile *pPrev = 0;
@@ -231,16 +232,25 @@
231232
for(nPrev=0; (c=pPrev->zName[nD+nPrev]) && c!='/'; nPrev++){}
232233
if( c=='/' ) nPrev++;
233234
}
234235
db_finalize(&ins);
235236
}else if( zD ){
236
- db_multi_exec(
237
- "INSERT OR IGNORE INTO localfiles"
238
- " SELECT pathelement(name,%d), NULL FROM filename"
239
- " WHERE name GLOB '%q/*'",
240
- nD, zD
241
- );
237
+ if( filenames_are_case_sensitive() ){
238
+ db_multi_exec(
239
+ "INSERT OR IGNORE INTO localfiles"
240
+ " SELECT pathelement(name,%d), NULL FROM filename"
241
+ " WHERE name GLOB '%q/*'",
242
+ nD, zD
243
+ );
244
+ }else{
245
+ db_multi_exec(
246
+ "INSERT OR IGNORE INTO localfiles"
247
+ " SELECT pathelement(name,%d), NULL FROM filename"
248
+ " WHERE name LIKE '%q/%%'",
249
+ nD, zD
250
+ );
251
+ }
242252
}else{
243253
db_multi_exec(
244254
"INSERT OR IGNORE INTO localfiles"
245255
" SELECT pathelement(name,0), NULL FROM filename"
246256
);
247257
--- src/browse.c
+++ src/browse.c
@@ -196,11 +196,12 @@
196 ** Subdirectory names begin with "/". This causes them to sort
197 ** first and it also gives us an easy way to distinguish files
198 ** from directories in the loop that follows.
199 */
200 db_multi_exec(
201 "CREATE TEMP TABLE localfiles(x UNIQUE NOT NULL, u);"
 
202 );
203 if( zCI ){
204 Stmt ins;
205 ManifestFile *pFile;
206 ManifestFile *pPrev = 0;
@@ -231,16 +232,25 @@
231 for(nPrev=0; (c=pPrev->zName[nD+nPrev]) && c!='/'; nPrev++){}
232 if( c=='/' ) nPrev++;
233 }
234 db_finalize(&ins);
235 }else if( zD ){
236 db_multi_exec(
237 "INSERT OR IGNORE INTO localfiles"
238 " SELECT pathelement(name,%d), NULL FROM filename"
239 " WHERE name GLOB '%q/*'",
240 nD, zD
241 );
 
 
 
 
 
 
 
 
 
242 }else{
243 db_multi_exec(
244 "INSERT OR IGNORE INTO localfiles"
245 " SELECT pathelement(name,0), NULL FROM filename"
246 );
247
--- src/browse.c
+++ src/browse.c
@@ -196,11 +196,12 @@
196 ** Subdirectory names begin with "/". This causes them to sort
197 ** first and it also gives us an easy way to distinguish files
198 ** from directories in the loop that follows.
199 */
200 db_multi_exec(
201 "CREATE TEMP TABLE localfiles(x UNIQUE NOT NULL %s, u);",
202 filename_collation()
203 );
204 if( zCI ){
205 Stmt ins;
206 ManifestFile *pFile;
207 ManifestFile *pPrev = 0;
@@ -231,16 +232,25 @@
232 for(nPrev=0; (c=pPrev->zName[nD+nPrev]) && c!='/'; nPrev++){}
233 if( c=='/' ) nPrev++;
234 }
235 db_finalize(&ins);
236 }else if( zD ){
237 if( filenames_are_case_sensitive() ){
238 db_multi_exec(
239 "INSERT OR IGNORE INTO localfiles"
240 " SELECT pathelement(name,%d), NULL FROM filename"
241 " WHERE name GLOB '%q/*'",
242 nD, zD
243 );
244 }else{
245 db_multi_exec(
246 "INSERT OR IGNORE INTO localfiles"
247 " SELECT pathelement(name,%d), NULL FROM filename"
248 " WHERE name LIKE '%q/%%'",
249 nD, zD
250 );
251 }
252 }else{
253 db_multi_exec(
254 "INSERT OR IGNORE INTO localfiles"
255 " SELECT pathelement(name,0), NULL FROM filename"
256 );
257
+23 -17
--- src/finfo.c
+++ src/finfo.c
@@ -39,22 +39,25 @@
3939
** In the -p form, there's an optional flag "-r|--revision REVISION".
4040
** The specified version (or the latest checked out version) is printed
4141
** to stdout.
4242
**
4343
** Options:
44
-** --brief|-b display a brief (one line / revision) summary
45
-** --limit N display the first N changes
46
-** --log|-l select log mode (the default)
47
-** --offset P skip P changes
48
-** -p select print mode
49
-** --revision|-r R print the given revision (or ckout, if none is given)
50
-** to stdout (only in print mode)
51
-** -s select status mode (print a status indicator for FILE)
44
+** --brief|-b display a brief (one line / revision) summary
45
+** --limit N display the first N changes
46
+** --log|-l select log mode (the default)
47
+** --offset P skip P changes
48
+** -p select print mode
49
+** --revision|-r R print the given revision (or ckout, if none is given)
50
+** to stdout (only in print mode)
51
+** -s select status mode (print a status indicator for FILE)
52
+** --case-sensitive B Enable or disable case-sensitive filenames. B is a
53
+** boolean: "yes", "no", "true", "false", etc.
5254
**
5355
** See also: descendants, info, leaves
5456
*/
5557
void finfo_cmd(void){
58
+ capture_case_sensitive_option();
5659
db_must_be_within_tree();
5760
if (find_option("status","s",0)) {
5861
Stmt q;
5962
Blob line;
6063
Blob fname;
@@ -67,11 +70,12 @@
6770
}
6871
vfile_check_signature(vid, 1, 0);
6972
file_tree_name(g.argv[2], &fname, 1);
7073
db_prepare(&q,
7174
"SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)"
72
- " FROM vfile WHERE vfile.pathname=%B", &fname);
75
+ " FROM vfile WHERE vfile.pathname=%B %s",
76
+ &fname, filename_collation());
7377
blob_zero(&line);
7478
if ( db_step(&q)==SQLITE_ROW ) {
7579
Blob uuid;
7680
int isDeleted = db_column_int(&q, 1);
7781
int isNew = db_column_int(&q,2) == 0;
@@ -80,12 +84,12 @@
8084
8185
blob_zero(&uuid);
8286
db_blob(&uuid,
8387
"SELECT uuid FROM blob, mlink, vfile WHERE "
8488
"blob.rid = mlink.mid AND mlink.fid = vfile.rid AND "
85
- "vfile.pathname=%B",
86
- &fname
89
+ "vfile.pathname=%B %s",
90
+ &fname, filename_collation()
8791
);
8892
if( isNew ){
8993
blob_appendf(&line, "new");
9094
}else if( isDeleted ){
9195
blob_appendf(&line, "deleted");
@@ -113,11 +117,12 @@
113117
114118
file_tree_name(g.argv[2], &fname, 1);
115119
if( zRevision ){
116120
historical_version_of_file(zRevision, blob_str(&fname), &record, 0, 0, 0);
117121
}else{
118
- int rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B", &fname);
122
+ int rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B %s",
123
+ &fname, filename_collation());
119124
if( rid==0 ){
120125
fossil_fatal("no history for file: %b", &fname);
121126
}
122127
content_get(rid, &record);
123128
}
@@ -144,27 +149,28 @@
144149
iBrief = (find_option("brief","b",0) == 0);
145150
if( g.argc!=3 ){
146151
usage("?-l|--log? ?-b|--brief? FILENAME");
147152
}
148153
file_tree_name(g.argv[2], &fname, 1);
149
- rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B", &fname);
154
+ rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B %s",
155
+ &fname, filename_collation());
150156
if( rid==0 ){
151157
fossil_fatal("no history for file: %b", &fname);
152158
}
153159
zFilename = blob_str(&fname);
154160
db_prepare(&q,
155161
"SELECT b.uuid, ci.uuid, date(event.mtime,'localtime'),"
156162
" coalesce(event.ecomment, event.comment),"
157163
" coalesce(event.euser, event.user)"
158164
" FROM mlink, blob b, event, blob ci, filename"
159
- " WHERE filename.name=%Q"
165
+ " WHERE filename.name=%Q %s"
160166
" AND mlink.fnid=filename.fnid"
161167
" AND b.rid=mlink.fid"
162168
" AND event.objid=mlink.mid"
163169
" AND event.objid=ci.rid"
164170
" ORDER BY event.mtime DESC LIMIT %d OFFSET %d",
165
- zFilename, iLimit, iOffset
171
+ zFilename, filename_collation(), iLimit, iOffset
166172
);
167173
blob_zero(&line);
168174
if( iBrief ){
169175
fossil_print("History of %s\n", blob_str(&fname));
170176
}
@@ -243,14 +249,14 @@
243249
" (SELECT uuid FROM blob WHERE rid=mlink.mid)," /* Check-in uuid */
244250
" event.bgcolor," /* Background color */
245251
" (SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0"
246252
" AND tagxref.rid=mlink.mid)" /* Tags */
247253
" FROM mlink, event"
248
- " WHERE mlink.fnid=(SELECT fnid FROM filename WHERE name=%Q)"
254
+ " WHERE mlink.fnid IN (SELECT fnid FROM filename WHERE name=%Q %s)"
249255
" AND event.objid=mlink.mid",
250256
TAG_BRANCH,
251
- zFilename
257
+ zFilename, filename_collation()
252258
);
253259
if( (zA = P("a"))!=0 ){
254260
blob_appendf(&sql, " AND event.mtime>=julianday('%q')", zA);
255261
}
256262
if( (zB = P("b"))!=0 ){
257263
--- src/finfo.c
+++ src/finfo.c
@@ -39,22 +39,25 @@
39 ** In the -p form, there's an optional flag "-r|--revision REVISION".
40 ** The specified version (or the latest checked out version) is printed
41 ** to stdout.
42 **
43 ** Options:
44 ** --brief|-b display a brief (one line / revision) summary
45 ** --limit N display the first N changes
46 ** --log|-l select log mode (the default)
47 ** --offset P skip P changes
48 ** -p select print mode
49 ** --revision|-r R print the given revision (or ckout, if none is given)
50 ** to stdout (only in print mode)
51 ** -s select status mode (print a status indicator for FILE)
 
 
52 **
53 ** See also: descendants, info, leaves
54 */
55 void finfo_cmd(void){
 
56 db_must_be_within_tree();
57 if (find_option("status","s",0)) {
58 Stmt q;
59 Blob line;
60 Blob fname;
@@ -67,11 +70,12 @@
67 }
68 vfile_check_signature(vid, 1, 0);
69 file_tree_name(g.argv[2], &fname, 1);
70 db_prepare(&q,
71 "SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)"
72 " FROM vfile WHERE vfile.pathname=%B", &fname);
 
73 blob_zero(&line);
74 if ( db_step(&q)==SQLITE_ROW ) {
75 Blob uuid;
76 int isDeleted = db_column_int(&q, 1);
77 int isNew = db_column_int(&q,2) == 0;
@@ -80,12 +84,12 @@
80
81 blob_zero(&uuid);
82 db_blob(&uuid,
83 "SELECT uuid FROM blob, mlink, vfile WHERE "
84 "blob.rid = mlink.mid AND mlink.fid = vfile.rid AND "
85 "vfile.pathname=%B",
86 &fname
87 );
88 if( isNew ){
89 blob_appendf(&line, "new");
90 }else if( isDeleted ){
91 blob_appendf(&line, "deleted");
@@ -113,11 +117,12 @@
113
114 file_tree_name(g.argv[2], &fname, 1);
115 if( zRevision ){
116 historical_version_of_file(zRevision, blob_str(&fname), &record, 0, 0, 0);
117 }else{
118 int rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B", &fname);
 
119 if( rid==0 ){
120 fossil_fatal("no history for file: %b", &fname);
121 }
122 content_get(rid, &record);
123 }
@@ -144,27 +149,28 @@
144 iBrief = (find_option("brief","b",0) == 0);
145 if( g.argc!=3 ){
146 usage("?-l|--log? ?-b|--brief? FILENAME");
147 }
148 file_tree_name(g.argv[2], &fname, 1);
149 rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B", &fname);
 
150 if( rid==0 ){
151 fossil_fatal("no history for file: %b", &fname);
152 }
153 zFilename = blob_str(&fname);
154 db_prepare(&q,
155 "SELECT b.uuid, ci.uuid, date(event.mtime,'localtime'),"
156 " coalesce(event.ecomment, event.comment),"
157 " coalesce(event.euser, event.user)"
158 " FROM mlink, blob b, event, blob ci, filename"
159 " WHERE filename.name=%Q"
160 " AND mlink.fnid=filename.fnid"
161 " AND b.rid=mlink.fid"
162 " AND event.objid=mlink.mid"
163 " AND event.objid=ci.rid"
164 " ORDER BY event.mtime DESC LIMIT %d OFFSET %d",
165 zFilename, iLimit, iOffset
166 );
167 blob_zero(&line);
168 if( iBrief ){
169 fossil_print("History of %s\n", blob_str(&fname));
170 }
@@ -243,14 +249,14 @@
243 " (SELECT uuid FROM blob WHERE rid=mlink.mid)," /* Check-in uuid */
244 " event.bgcolor," /* Background color */
245 " (SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0"
246 " AND tagxref.rid=mlink.mid)" /* Tags */
247 " FROM mlink, event"
248 " WHERE mlink.fnid=(SELECT fnid FROM filename WHERE name=%Q)"
249 " AND event.objid=mlink.mid",
250 TAG_BRANCH,
251 zFilename
252 );
253 if( (zA = P("a"))!=0 ){
254 blob_appendf(&sql, " AND event.mtime>=julianday('%q')", zA);
255 }
256 if( (zB = P("b"))!=0 ){
257
--- src/finfo.c
+++ src/finfo.c
@@ -39,22 +39,25 @@
39 ** In the -p form, there's an optional flag "-r|--revision REVISION".
40 ** The specified version (or the latest checked out version) is printed
41 ** to stdout.
42 **
43 ** Options:
44 ** --brief|-b display a brief (one line / revision) summary
45 ** --limit N display the first N changes
46 ** --log|-l select log mode (the default)
47 ** --offset P skip P changes
48 ** -p select print mode
49 ** --revision|-r R print the given revision (or ckout, if none is given)
50 ** to stdout (only in print mode)
51 ** -s select status mode (print a status indicator for FILE)
52 ** --case-sensitive B Enable or disable case-sensitive filenames. B is a
53 ** boolean: "yes", "no", "true", "false", etc.
54 **
55 ** See also: descendants, info, leaves
56 */
57 void finfo_cmd(void){
58 capture_case_sensitive_option();
59 db_must_be_within_tree();
60 if (find_option("status","s",0)) {
61 Stmt q;
62 Blob line;
63 Blob fname;
@@ -67,11 +70,12 @@
70 }
71 vfile_check_signature(vid, 1, 0);
72 file_tree_name(g.argv[2], &fname, 1);
73 db_prepare(&q,
74 "SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)"
75 " FROM vfile WHERE vfile.pathname=%B %s",
76 &fname, filename_collation());
77 blob_zero(&line);
78 if ( db_step(&q)==SQLITE_ROW ) {
79 Blob uuid;
80 int isDeleted = db_column_int(&q, 1);
81 int isNew = db_column_int(&q,2) == 0;
@@ -80,12 +84,12 @@
84
85 blob_zero(&uuid);
86 db_blob(&uuid,
87 "SELECT uuid FROM blob, mlink, vfile WHERE "
88 "blob.rid = mlink.mid AND mlink.fid = vfile.rid AND "
89 "vfile.pathname=%B %s",
90 &fname, filename_collation()
91 );
92 if( isNew ){
93 blob_appendf(&line, "new");
94 }else if( isDeleted ){
95 blob_appendf(&line, "deleted");
@@ -113,11 +117,12 @@
117
118 file_tree_name(g.argv[2], &fname, 1);
119 if( zRevision ){
120 historical_version_of_file(zRevision, blob_str(&fname), &record, 0, 0, 0);
121 }else{
122 int rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B %s",
123 &fname, filename_collation());
124 if( rid==0 ){
125 fossil_fatal("no history for file: %b", &fname);
126 }
127 content_get(rid, &record);
128 }
@@ -144,27 +149,28 @@
149 iBrief = (find_option("brief","b",0) == 0);
150 if( g.argc!=3 ){
151 usage("?-l|--log? ?-b|--brief? FILENAME");
152 }
153 file_tree_name(g.argv[2], &fname, 1);
154 rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B %s",
155 &fname, filename_collation());
156 if( rid==0 ){
157 fossil_fatal("no history for file: %b", &fname);
158 }
159 zFilename = blob_str(&fname);
160 db_prepare(&q,
161 "SELECT b.uuid, ci.uuid, date(event.mtime,'localtime'),"
162 " coalesce(event.ecomment, event.comment),"
163 " coalesce(event.euser, event.user)"
164 " FROM mlink, blob b, event, blob ci, filename"
165 " WHERE filename.name=%Q %s"
166 " AND mlink.fnid=filename.fnid"
167 " AND b.rid=mlink.fid"
168 " AND event.objid=mlink.mid"
169 " AND event.objid=ci.rid"
170 " ORDER BY event.mtime DESC LIMIT %d OFFSET %d",
171 zFilename, filename_collation(), iLimit, iOffset
172 );
173 blob_zero(&line);
174 if( iBrief ){
175 fossil_print("History of %s\n", blob_str(&fname));
176 }
@@ -243,14 +249,14 @@
249 " (SELECT uuid FROM blob WHERE rid=mlink.mid)," /* Check-in uuid */
250 " event.bgcolor," /* Background color */
251 " (SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0"
252 " AND tagxref.rid=mlink.mid)" /* Tags */
253 " FROM mlink, event"
254 " WHERE mlink.fnid IN (SELECT fnid FROM filename WHERE name=%Q %s)"
255 " AND event.objid=mlink.mid",
256 TAG_BRANCH,
257 zFilename, filename_collation()
258 );
259 if( (zA = P("a"))!=0 ){
260 blob_appendf(&sql, " AND event.mtime>=julianday('%q')", zA);
261 }
262 if( (zB = P("b"))!=0 ){
263
--- src/manifest.c
+++ src/manifest.c
@@ -1223,10 +1223,38 @@
12231223
fetch_baseline(p, 1);
12241224
pFile = manifest_file_seek_base(p->pBaseline, zName);
12251225
}
12261226
return pFile;
12271227
}
1228
+
1229
+/*
1230
+** Look for a file in a manifest, taking the case-sensitive option
1231
+** into account. If case-sensitive is off, then files in any case
1232
+** will match.
1233
+*/
1234
+ManifestFile *manifest_file_find(Manifest *p, const char *zName){
1235
+ int i, n;
1236
+ Manifest *pBase;
1237
+ if( filenames_are_case_sensitive() ){
1238
+ return manifest_file_seek(p, zName);
1239
+ }
1240
+ for(i=0; i<p->nFile; i++){
1241
+ if( fossil_stricmp(zName, p->aFile[i].zName)==0 ){
1242
+ return &p->aFile[i];
1243
+ }
1244
+ }
1245
+ if( p->zBaseline==0 ) return 0;
1246
+ fetch_baseline(p, 1);
1247
+ pBase = p->pBaseline;
1248
+ if( pBase==0 ) return 0;
1249
+ for(i=0; i<pBase->nFile; i++){
1250
+ if( fossil_stricmp(zName, p->aFile[i].zName)==0 ){
1251
+ return &p->aFile[i];
1252
+ }
1253
+ }
1254
+ return 0;
1255
+}
12281256
12291257
/*
12301258
** Add mlink table entries associated with manifest cid, pChild. The
12311259
** parent manifest is pid, pParent. One of either pChild or pParent
12321260
** will be NULL and it will be computed based on cid/pid.
12331261
--- src/manifest.c
+++ src/manifest.c
@@ -1223,10 +1223,38 @@
1223 fetch_baseline(p, 1);
1224 pFile = manifest_file_seek_base(p->pBaseline, zName);
1225 }
1226 return pFile;
1227 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1228
1229 /*
1230 ** Add mlink table entries associated with manifest cid, pChild. The
1231 ** parent manifest is pid, pParent. One of either pChild or pParent
1232 ** will be NULL and it will be computed based on cid/pid.
1233
--- src/manifest.c
+++ src/manifest.c
@@ -1223,10 +1223,38 @@
1223 fetch_baseline(p, 1);
1224 pFile = manifest_file_seek_base(p->pBaseline, zName);
1225 }
1226 return pFile;
1227 }
1228
1229 /*
1230 ** Look for a file in a manifest, taking the case-sensitive option
1231 ** into account. If case-sensitive is off, then files in any case
1232 ** will match.
1233 */
1234 ManifestFile *manifest_file_find(Manifest *p, const char *zName){
1235 int i, n;
1236 Manifest *pBase;
1237 if( filenames_are_case_sensitive() ){
1238 return manifest_file_seek(p, zName);
1239 }
1240 for(i=0; i<p->nFile; i++){
1241 if( fossil_stricmp(zName, p->aFile[i].zName)==0 ){
1242 return &p->aFile[i];
1243 }
1244 }
1245 if( p->zBaseline==0 ) return 0;
1246 fetch_baseline(p, 1);
1247 pBase = p->pBaseline;
1248 if( pBase==0 ) return 0;
1249 for(i=0; i<pBase->nFile; i++){
1250 if( fossil_stricmp(zName, p->aFile[i].zName)==0 ){
1251 return &p->aFile[i];
1252 }
1253 }
1254 return 0;
1255 }
1256
1257 /*
1258 ** Add mlink table entries associated with manifest cid, pChild. The
1259 ** parent manifest is pid, pParent. One of either pChild or pParent
1260 ** will be NULL and it will be computed based on cid/pid.
1261
+1 -1
--- src/update.c
+++ src/update.c
@@ -575,11 +575,11 @@
575575
fossil_fatal("no such checkin: %s", revision);
576576
}
577577
pManifest = manifest_get(rid, CFTYPE_MANIFEST);
578578
579579
if( pManifest ){
580
- pFile = manifest_file_seek(pManifest, file);
580
+ pFile = manifest_file_find(pManifest, file);
581581
if( pFile ){
582582
rid = uuid_to_rid(pFile->zUuid, 0);
583583
if( pIsExe ) *pIsExe = ( manifest_file_mperm(pFile)==PERM_EXE );
584584
if( pIsLink ) *pIsLink = ( manifest_file_mperm(pFile)==PERM_LNK );
585585
manifest_destroy(pManifest);
586586
--- src/update.c
+++ src/update.c
@@ -575,11 +575,11 @@
575 fossil_fatal("no such checkin: %s", revision);
576 }
577 pManifest = manifest_get(rid, CFTYPE_MANIFEST);
578
579 if( pManifest ){
580 pFile = manifest_file_seek(pManifest, file);
581 if( pFile ){
582 rid = uuid_to_rid(pFile->zUuid, 0);
583 if( pIsExe ) *pIsExe = ( manifest_file_mperm(pFile)==PERM_EXE );
584 if( pIsLink ) *pIsLink = ( manifest_file_mperm(pFile)==PERM_LNK );
585 manifest_destroy(pManifest);
586
--- src/update.c
+++ src/update.c
@@ -575,11 +575,11 @@
575 fossil_fatal("no such checkin: %s", revision);
576 }
577 pManifest = manifest_get(rid, CFTYPE_MANIFEST);
578
579 if( pManifest ){
580 pFile = manifest_file_find(pManifest, file);
581 if( pFile ){
582 rid = uuid_to_rid(pFile->zUuid, 0);
583 if( pIsExe ) *pIsExe = ( manifest_file_mperm(pFile)==PERM_EXE );
584 if( pIsLink ) *pIsLink = ( manifest_file_mperm(pFile)==PERM_LNK );
585 manifest_destroy(pManifest);
586

Keyboard Shortcuts

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