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].
Commit
6e59eb117f1e1f807427a9358005d5feaee594d7
Parent
07556099ab20600…
1 file changed
+4
-1
+4
-1
| --- src/browse.c | ||
| +++ src/browse.c | ||
| @@ -210,11 +210,14 @@ | ||
| 210 | 210 | "INSERT OR IGNORE INTO localfiles VALUES(pathelement(:x,0), :u)" |
| 211 | 211 | ); |
| 212 | 212 | manifest_file_rewind(pM); |
| 213 | 213 | while( (pFile = manifest_file_next(pM,0))!=0 ){ |
| 214 | 214 | 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 | + ){ | |
| 216 | 219 | continue; |
| 217 | 220 | } |
| 218 | 221 | db_bind_text(&ins, ":x", &pFile->zName[nD]); |
| 219 | 222 | db_bind_text(&ins, ":u", pFile->zUuid); |
| 220 | 223 | db_step(&ins); |
| 221 | 224 |
| --- 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 |