Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Enhancements to "fossil add" and "fossil rm" so that they work recursively on directories and ignore trailing / characters. Patches from Carles Pagès. |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
04ddad7ab8e5c8bfe23daad995a73ead |
User & Date: | drh 2011-03-19 18:14:45.849 |
Original Comment: | Enhancements to "fossil add" and "fossil rm" so that they work recursively on directories and ignore trailing / characters. Patches from Carles Pags. |
References
2011-03-21
| ||
00:35 | • Ticket [118a98cb38] removing a directory doesn't work with a trailing slash status still Open with 1 other change artifact: da1c82f03b user: anonymous | |
Context
2011-03-22
| ||
17:00 | Add the https-login setting which forces a switch to HTTPS for any non-anonymous login. check-in: be0e804130 user: drh tags: trunk | |
2011-03-19
| ||
18:14 | Enhancements to "fossil add" and "fossil rm" so that they work recursively on directories and ignore trailing / characters. Patches from Carles Pagès. check-in: 04ddad7ab8 user: drh tags: trunk | |
2011-03-18
| ||
02:51 | When a server is pointing to a directory, allow *.fossil files to be served out of any subdirectory of that directory. For security, pathnames may not contain any characters except alphanumerics, "/", "-", and "_". check-in: d04fa1e143 user: drh tags: trunk | |
Changes
Changes to src/add.c.
︙ | ︙ | |||
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | for(i=2; i<g.argc; i++){ char *zName; int isDir; zName = mprintf("%/", g.argv[i]); isDir = file_isdir(zName); if( isDir==1 ){ add_directory(zName, vid, &repo, pIgnore); }else if( isDir==0 ){ fossil_fatal("not found: %s", zName); }else if( access(zName, R_OK) ){ fossil_fatal("cannot open %s", zName); }else{ add_one_file(zName, vid, &repo); } free(zName); } if( pIgnore ) db_finalize(pIgnore); db_end_transaction(0); } /* ** Remove all contents of zDir */ void del_directory_content(const char *zDir){ DIR *d; int origSize; struct dirent *pEntry; | > > > > > > > > > > > > > > > > > > > > > | 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | for(i=2; i<g.argc; i++){ char *zName; int isDir; zName = mprintf("%/", g.argv[i]); isDir = file_isdir(zName); if( isDir==1 ){ int sz = strlen(zName); if( sz>0 && zName[sz-1]=='/' ){ zName[sz-1] = 0; } add_directory(zName, vid, &repo, pIgnore); }else if( isDir==0 ){ fossil_fatal("not found: %s", zName); }else if( access(zName, R_OK) ){ fossil_fatal("cannot open %s", zName); }else{ add_one_file(zName, vid, &repo); } free(zName); } if( pIgnore ) db_finalize(pIgnore); db_end_transaction(0); } /* ** Unmangage a single file. */ void delete_one_file(const char *zName){ char *zPath; Blob pathname; file_tree_name(zName, &pathname, 1); zPath = blob_str(&pathname); if( !db_exists( "SELECT 1 FROM vfile WHERE pathname=%Q AND NOT deleted", zPath) ){ fossil_fatal("not in the repository: %s", zName); }else{ db_multi_exec("UPDATE vfile SET deleted=1 WHERE pathname=%Q", zPath); printf("DELETED %s\n", zPath); } blob_reset(&pathname); } /* ** Remove all contents of zDir */ void del_directory_content(const char *zDir){ DIR *d; int origSize; struct dirent *pEntry; |
︙ | ︙ | |||
304 305 306 307 308 309 310 | if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue; } blob_appendf(&path, "/%s", pEntry->d_name); zPath = blob_str(&path); if( file_isdir(zPath)==1 ){ del_directory_content(zPath); }else if( file_isfile(zPath) ){ | < < < < < < < | < < < < < | 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue; } blob_appendf(&path, "/%s", pEntry->d_name); zPath = blob_str(&path); if( file_isdir(zPath)==1 ){ del_directory_content(zPath); }else if( file_isfile(zPath) ){ delete_one_file(zPath); } blob_resize(&path, origSize); } closedir(d); } blob_reset(&path); } |
︙ | ︙ | |||
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | } db_begin_transaction(); for(i=2; i<g.argc; i++){ char *zName; zName = mprintf("%/", g.argv[i]); if( file_isdir(zName) == 1 ){ del_directory_content(zName); } else { char *zPath; Blob pathname; file_tree_name(zName, &pathname, 1); zPath = blob_str(&pathname); if( !db_exists( "SELECT 1 FROM vfile WHERE pathname=%Q AND NOT deleted", zPath) ){ fossil_fatal("not in the repository: %s", zName); }else{ | > > < | | 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | } db_begin_transaction(); for(i=2; i<g.argc; i++){ char *zName; zName = mprintf("%/", g.argv[i]); if( file_isdir(zName) == 1 ){ int sz = strlen(zName); if( sz>0 && zName[sz-1]=='/' ){ zName[sz-1] = 0; } del_directory_content(zName); } else { char *zPath; Blob pathname; file_tree_name(zName, &pathname, 1); zPath = blob_str(&pathname); if( !db_exists( "SELECT 1 FROM vfile WHERE pathname=%Q AND NOT deleted", zPath) ){ fossil_fatal("not in the repository: %s", zName); }else{ delete_one_file(zPath); } blob_reset(&pathname); } free(zName); } db_multi_exec("DELETE FROM vfile WHERE deleted AND rid=0"); db_end_transaction(0); |
︙ | ︙ |