| | @@ -115,10 +115,13 @@ |
| 115 | 115 | } |
| 116 | 116 | if( !nochangeFlag && db_exists("SELECT 1 FROM vmerge") ){ |
| 117 | 117 | fossil_fatal("cannot update an uncommitted merge"); |
| 118 | 118 | } |
| 119 | 119 | if( !nochangeFlag && !internalUpdate ) autosync(AUTOSYNC_PULL); |
| 120 | + |
| 121 | + /* Create any empty directories now, as well as after the update, so changes in settings are reflected now */ |
| 122 | + ensure_empty_dirs_created(); |
| 120 | 123 | |
| 121 | 124 | if( internalUpdate ){ |
| 122 | 125 | tid = internalUpdate; |
| 123 | 126 | }else if( g.argc>=3 ){ |
| 124 | 127 | if( strcmp(g.argv[2], "current")==0 ){ |
| | @@ -440,10 +443,11 @@ |
| 440 | 443 | ** Clean up the mid and pid VFILE entries. Then commit the changes. |
| 441 | 444 | */ |
| 442 | 445 | if( nochangeFlag ){ |
| 443 | 446 | db_end_transaction(1); /* With --nochange, rollback changes */ |
| 444 | 447 | }else{ |
| 448 | + ensure_empty_dirs_created(); |
| 445 | 449 | if( g.argc<=3 ){ |
| 446 | 450 | /* All files updated. Shift the current checkout to the target. */ |
| 447 | 451 | db_multi_exec("DELETE FROM vfile WHERE vid!=%d", tid); |
| 448 | 452 | checkout_set_all_exe(vid); |
| 449 | 453 | manifest_to_disk(tid); |
| | @@ -455,10 +459,35 @@ |
| 455 | 459 | } |
| 456 | 460 | if( !internalUpdate ) undo_finish(); |
| 457 | 461 | db_end_transaction(0); |
| 458 | 462 | } |
| 459 | 463 | } |
| 464 | + |
| 465 | +/* |
| 466 | +** Make sure empty directories are created |
| 467 | +*/ |
| 468 | +void ensure_empty_dirs_created() |
| 469 | +{ |
| 470 | + /* Make empty directories? */ |
| 471 | + char *zEmptyDirs = db_get_versionable_setting("empty-dirs", 0); |
| 472 | + if( zEmptyDirs!=0 ){ |
| 473 | + Blob dirsList, line; |
| 474 | + blob_zero(&dirsList); |
| 475 | + blob_init(&dirsList, zEmptyDirs, strlen(zEmptyDirs)); |
| 476 | + while( blob_line(&dirsList, &line) ){ |
| 477 | + if( blob_buffer(&line)[0]=='#' ) continue; |
| 478 | + Blob dirName; |
| 479 | + int l = blob_token(&line, &dirName); |
| 480 | + if(l > 0) { |
| 481 | + /* Try and create the directory */ |
| 482 | + if( file_mkdir(blob_str(&dirName), 0)!=0 ) { |
| 483 | + fossil_warning("couldn't create empty-dir %s", blob_str(&dirName)); |
| 484 | + } |
| 485 | + } |
| 486 | + } |
| 487 | + } |
| 488 | +} |
| 460 | 489 | |
| 461 | 490 | |
| 462 | 491 | /* |
| 463 | 492 | ** Get the contents of a file within the checking "revision". If |
| 464 | 493 | ** revision==NULL then get the file content for the current checkout. |
| 465 | 494 | |