Fossil SCM

Fix stash pop/apply truncating binary files on conflict; leave file untouched and point user to merge side-files.

mgagnon 2026-07-24 02:49 UTC trunk
Commit 071cf8cb58fd53c053a66b232287580e3e3339aea11c71da017864c30ef5c22c
1 file changed +8 -2
+8 -2
--- src/stash.c
+++ src/stash.c
@@ -365,16 +365,22 @@
365365
rc = -1;
366366
blob_zero(&b); /* because we reset it later */
367367
fossil_print("***** Cannot merge symlink %s\n", zNew);
368368
}else{
369369
rc = merge_3way(&a, zOPath, &b, &out, MERGE_KEEP_FILES);
370
- blob_write_to_file(&out, zNPath);
370
+ if( rc>=0 ){
371
+ blob_write_to_file(&out, zNPath);
372
+ file_setexe(zNPath, isExec);
373
+ }
371374
blob_reset(&out);
372
- file_setexe(zNPath, isExec);
373375
}
374376
if( rc ){
375377
fossil_print("CONFLICT %s\n", zNew);
378
+ if( rc<0 ){
379
+ fossil_print(" binary file left unchanged - resolve using "
380
+ "-baseline/-original/-merge\n");
381
+ }
376382
nConflict++;
377383
}else{
378384
fossil_print("MERGE %s\n", zNew);
379385
}
380386
}
381387
--- src/stash.c
+++ src/stash.c
@@ -365,16 +365,22 @@
365 rc = -1;
366 blob_zero(&b); /* because we reset it later */
367 fossil_print("***** Cannot merge symlink %s\n", zNew);
368 }else{
369 rc = merge_3way(&a, zOPath, &b, &out, MERGE_KEEP_FILES);
370 blob_write_to_file(&out, zNPath);
 
 
 
371 blob_reset(&out);
372 file_setexe(zNPath, isExec);
373 }
374 if( rc ){
375 fossil_print("CONFLICT %s\n", zNew);
 
 
 
 
376 nConflict++;
377 }else{
378 fossil_print("MERGE %s\n", zNew);
379 }
380 }
381
--- src/stash.c
+++ src/stash.c
@@ -365,16 +365,22 @@
365 rc = -1;
366 blob_zero(&b); /* because we reset it later */
367 fossil_print("***** Cannot merge symlink %s\n", zNew);
368 }else{
369 rc = merge_3way(&a, zOPath, &b, &out, MERGE_KEEP_FILES);
370 if( rc>=0 ){
371 blob_write_to_file(&out, zNPath);
372 file_setexe(zNPath, isExec);
373 }
374 blob_reset(&out);
 
375 }
376 if( rc ){
377 fossil_print("CONFLICT %s\n", zNew);
378 if( rc<0 ){
379 fossil_print(" binary file left unchanged - resolve using "
380 "-baseline/-original/-merge\n");
381 }
382 nConflict++;
383 }else{
384 fossil_print("MERGE %s\n", zNew);
385 }
386 }
387

Keyboard Shortcuts

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