Fossil SCM

Fix the display of file and directory listings so that it works correctly even when one file in a directory is a prefix of another. Ticket [8e13d170f2d6d6e3].

drh 2011-01-25 21:59 trunk
Commit 6e59eb117f1e1f807427a9358005d5feaee594d7
1 file changed +4 -1
+4 -1
--- src/browse.c
+++ src/browse.c
@@ -210,11 +210,14 @@
210210
"INSERT OR IGNORE INTO localfiles VALUES(pathelement(:x,0), :u)"
211211
);
212212
manifest_file_rewind(pM);
213213
while( (pFile = manifest_file_next(pM,0))!=0 ){
214214
if( nD>0 && memcmp(pFile->zName, zD, nD-1)!=0 ) continue;
215
- if( pPrev && memcmp(&pFile->zName[nD],&pPrev->zName[nD],nPrev)==0 ){
215
+ if( pPrev
216
+ && memcmp(&pFile->zName[nD],&pPrev->zName[nD],nPrev)==0
217
+ && (pFile->zName[nD+nPrev]==0 || pFile->zName[nD+nPrev]=='/')
218
+ ){
216219
continue;
217220
}
218221
db_bind_text(&ins, ":x", &pFile->zName[nD]);
219222
db_bind_text(&ins, ":u", pFile->zUuid);
220223
db_step(&ins);
221224
--- src/browse.c
+++ src/browse.c
@@ -210,11 +210,14 @@
210 "INSERT OR IGNORE INTO localfiles VALUES(pathelement(:x,0), :u)"
211 );
212 manifest_file_rewind(pM);
213 while( (pFile = manifest_file_next(pM,0))!=0 ){
214 if( nD>0 && memcmp(pFile->zName, zD, nD-1)!=0 ) continue;
215 if( pPrev && memcmp(&pFile->zName[nD],&pPrev->zName[nD],nPrev)==0 ){
 
 
 
216 continue;
217 }
218 db_bind_text(&ins, ":x", &pFile->zName[nD]);
219 db_bind_text(&ins, ":u", pFile->zUuid);
220 db_step(&ins);
221
--- src/browse.c
+++ src/browse.c
@@ -210,11 +210,14 @@
210 "INSERT OR IGNORE INTO localfiles VALUES(pathelement(:x,0), :u)"
211 );
212 manifest_file_rewind(pM);
213 while( (pFile = manifest_file_next(pM,0))!=0 ){
214 if( nD>0 && memcmp(pFile->zName, zD, nD-1)!=0 ) continue;
215 if( pPrev
216 && memcmp(&pFile->zName[nD],&pPrev->zName[nD],nPrev)==0
217 && (pFile->zName[nD+nPrev]==0 || pFile->zName[nD+nPrev]=='/')
218 ){
219 continue;
220 }
221 db_bind_text(&ins, ":x", &pFile->zName[nD]);
222 db_bind_text(&ins, ":u", pFile->zUuid);
223 db_step(&ins);
224

Keyboard Shortcuts

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