Fossil SCM

Fix an issue with "fossil patch pull" on Windows when multiple files are being deleted by the patch.

drh 2024-10-28 19:17 trunk
Commit 8beffa1eb4154a2b0a65fc444997aad9fbcf4fbe9985333b82bc105bba277d0f
1 file changed +6 -2
+6 -2
--- src/patch.c
+++ src/patch.c
@@ -464,18 +464,22 @@
464464
465465
/* Deletions */
466466
db_prepare(&q, "SELECT pathname FROM patch.chng"
467467
" WHERE origname IS NULL AND delta IS NULL");
468468
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));
471474
if( mFlags & PATCH_VERBOSE ){
472475
fossil_print("%-10s %s\n", "DELETE", db_column_text(&q,0));
473476
}
474477
}
475478
db_finalize(&q);
476479
if( blob_size(&cmd)>0 ){
480
+ blob_appendf(&cmd, "\n");
477481
if( mFlags & PATCH_DRYRUN ){
478482
fossil_print("%s", blob_str(&cmd));
479483
}else{
480484
int rc = fossil_unsafe_system(blob_str(&cmd));
481485
if( rc ){
482486
--- 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

Keyboard Shortcuts

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