Fossil SCM
Fix an issue with "fossil patch pull" on Windows when multiple files are being deleted by the patch.
Commit
8beffa1eb4154a2b0a65fc444997aad9fbcf4fbe9985333b82bc105bba277d0f
Parent
7d50f6142cc0e92…
1 file changed
+6
-2
+6
-2
| --- src/patch.c | ||
| +++ src/patch.c | ||
| @@ -464,18 +464,22 @@ | ||
| 464 | 464 | |
| 465 | 465 | /* Deletions */ |
| 466 | 466 | db_prepare(&q, "SELECT pathname FROM patch.chng" |
| 467 | 467 | " WHERE origname IS NULL AND delta IS NULL"); |
| 468 | 468 | while( db_step(&q)==SQLITE_ROW ){ |
| 469 | - blob_append_escaped_arg(&cmd, g.nameOfExe, 1); | |
| 470 | - blob_appendf(&cmd, " rm --hard %$\n", db_column_text(&q,0)); | |
| 469 | + if( blob_size(&cmd)==0 ){ | |
| 470 | + blob_append_escaped_arg(&cmd, g.nameOfExe, 1); | |
| 471 | + blob_appendf(&cmd, " rm --hard"); | |
| 472 | + } | |
| 473 | + blob_appendf(&cmd, " %$", db_column_text(&q,0)); | |
| 471 | 474 | if( mFlags & PATCH_VERBOSE ){ |
| 472 | 475 | fossil_print("%-10s %s\n", "DELETE", db_column_text(&q,0)); |
| 473 | 476 | } |
| 474 | 477 | } |
| 475 | 478 | db_finalize(&q); |
| 476 | 479 | if( blob_size(&cmd)>0 ){ |
| 480 | + blob_appendf(&cmd, "\n"); | |
| 477 | 481 | if( mFlags & PATCH_DRYRUN ){ |
| 478 | 482 | fossil_print("%s", blob_str(&cmd)); |
| 479 | 483 | }else{ |
| 480 | 484 | int rc = fossil_unsafe_system(blob_str(&cmd)); |
| 481 | 485 | if( rc ){ |
| 482 | 486 |
| --- src/patch.c | |
| +++ src/patch.c | |
| @@ -464,18 +464,22 @@ | |
| 464 | |
| 465 | /* Deletions */ |
| 466 | db_prepare(&q, "SELECT pathname FROM patch.chng" |
| 467 | " WHERE origname IS NULL AND delta IS NULL"); |
| 468 | while( db_step(&q)==SQLITE_ROW ){ |
| 469 | blob_append_escaped_arg(&cmd, g.nameOfExe, 1); |
| 470 | blob_appendf(&cmd, " rm --hard %$\n", db_column_text(&q,0)); |
| 471 | if( mFlags & PATCH_VERBOSE ){ |
| 472 | fossil_print("%-10s %s\n", "DELETE", db_column_text(&q,0)); |
| 473 | } |
| 474 | } |
| 475 | db_finalize(&q); |
| 476 | if( blob_size(&cmd)>0 ){ |
| 477 | if( mFlags & PATCH_DRYRUN ){ |
| 478 | fossil_print("%s", blob_str(&cmd)); |
| 479 | }else{ |
| 480 | int rc = fossil_unsafe_system(blob_str(&cmd)); |
| 481 | if( rc ){ |
| 482 |
| --- src/patch.c | |
| +++ src/patch.c | |
| @@ -464,18 +464,22 @@ | |
| 464 | |
| 465 | /* Deletions */ |
| 466 | db_prepare(&q, "SELECT pathname FROM patch.chng" |
| 467 | " WHERE origname IS NULL AND delta IS NULL"); |
| 468 | while( db_step(&q)==SQLITE_ROW ){ |
| 469 | if( blob_size(&cmd)==0 ){ |
| 470 | blob_append_escaped_arg(&cmd, g.nameOfExe, 1); |
| 471 | blob_appendf(&cmd, " rm --hard"); |
| 472 | } |
| 473 | blob_appendf(&cmd, " %$", db_column_text(&q,0)); |
| 474 | if( mFlags & PATCH_VERBOSE ){ |
| 475 | fossil_print("%-10s %s\n", "DELETE", db_column_text(&q,0)); |
| 476 | } |
| 477 | } |
| 478 | db_finalize(&q); |
| 479 | if( blob_size(&cmd)>0 ){ |
| 480 | blob_appendf(&cmd, "\n"); |
| 481 | if( mFlags & PATCH_DRYRUN ){ |
| 482 | fossil_print("%s", blob_str(&cmd)); |
| 483 | }else{ |
| 484 | int rc = fossil_unsafe_system(blob_str(&cmd)); |
| 485 | if( rc ){ |
| 486 |