Fossil SCM

(1) stash drop without an ID now behaves like pop/apply when given no ID (it previously treated 0 as a stash ID, which silently did nothing useful). (2) result code 125 for skips was misdiagnosed, causing skips to be treated as bad. (3) bisect undo was applying a skip as a good checkin with RID 0, causing loss of the good marker. These were reported, and fixes suggested, off-list by Dan Mestas.

stephan 2026-10-29 09:11 UTC trunk
Commit 1259da6d3dd4e9fda3b2de601ee7cbf8dea7e6a700d6f5e65d2528cee43c5dbe
2 files changed +9 +2 -1
--- src/bisect.c
+++ src/bisect.c
@@ -20,10 +20,13 @@
2020
** changes that have occurred across multiple check-ins.
2121
*/
2222
#include "config.h"
2323
#include "bisect.h"
2424
#include <assert.h>
25
+#if !defined(_WIN32)
26
+# include <sys/wait.h>
27
+#endif
2528
2629
/*
2730
** Local variables for this module
2831
*/
2932
static struct {
@@ -447,10 +450,15 @@
447450
int rc;
448451
Blob cmd;
449452
blob_init(&cmd, 0, 0);
450453
blob_append_escaped_arg(&cmd, g.nameOfExe, 1);
451454
rc = fossil_unsafe_system(zCmd);
455
+#if !defined(_WIN32)
456
+ /* system() returns a wait status, not the exit code, so 125
457
+ ** ("skip") arrives as 125<<8. */
458
+ if( rc!=-1 && WIFEXITED(rc) ) rc = WEXITSTATUS(rc);
459
+#endif
452460
if( isInteractive ){
453461
Blob in;
454462
fossil_print("test-command result: %d\n", rc);
455463
while(1){
456464
int n;
@@ -656,10 +664,11 @@
656664
}
657665
blob_rewind(&log);
658666
for(i=0; i<cnt-1; i++){
659667
int rid;
660668
blob_token(&log, &id);
669
+ if( blob_str(&id)[0]=='s' ) continue /* a skip */;
661670
rid = atoi(blob_str(&id));
662671
if( rid<0 ) ridBad = -rid;
663672
else ridGood = rid;
664673
}
665674
db_multi_exec(
666675
--- src/bisect.c
+++ src/bisect.c
@@ -20,10 +20,13 @@
20 ** changes that have occurred across multiple check-ins.
21 */
22 #include "config.h"
23 #include "bisect.h"
24 #include <assert.h>
 
 
 
25
26 /*
27 ** Local variables for this module
28 */
29 static struct {
@@ -447,10 +450,15 @@
447 int rc;
448 Blob cmd;
449 blob_init(&cmd, 0, 0);
450 blob_append_escaped_arg(&cmd, g.nameOfExe, 1);
451 rc = fossil_unsafe_system(zCmd);
 
 
 
 
 
452 if( isInteractive ){
453 Blob in;
454 fossil_print("test-command result: %d\n", rc);
455 while(1){
456 int n;
@@ -656,10 +664,11 @@
656 }
657 blob_rewind(&log);
658 for(i=0; i<cnt-1; i++){
659 int rid;
660 blob_token(&log, &id);
 
661 rid = atoi(blob_str(&id));
662 if( rid<0 ) ridBad = -rid;
663 else ridGood = rid;
664 }
665 db_multi_exec(
666
--- src/bisect.c
+++ src/bisect.c
@@ -20,10 +20,13 @@
20 ** changes that have occurred across multiple check-ins.
21 */
22 #include "config.h"
23 #include "bisect.h"
24 #include <assert.h>
25 #if !defined(_WIN32)
26 # include <sys/wait.h>
27 #endif
28
29 /*
30 ** Local variables for this module
31 */
32 static struct {
@@ -447,10 +450,15 @@
450 int rc;
451 Blob cmd;
452 blob_init(&cmd, 0, 0);
453 blob_append_escaped_arg(&cmd, g.nameOfExe, 1);
454 rc = fossil_unsafe_system(zCmd);
455 #if !defined(_WIN32)
456 /* system() returns a wait status, not the exit code, so 125
457 ** ("skip") arrives as 125<<8. */
458 if( rc!=-1 && WIFEXITED(rc) ) rc = WEXITSTATUS(rc);
459 #endif
460 if( isInteractive ){
461 Blob in;
462 fossil_print("test-command result: %d\n", rc);
463 while(1){
464 int n;
@@ -656,10 +664,11 @@
664 }
665 blob_rewind(&log);
666 for(i=0; i<cnt-1; i++){
667 int rid;
668 blob_token(&log, &id);
669 if( blob_str(&id)[0]=='s' ) continue /* a skip */;
670 rid = atoi(blob_str(&id));
671 if( rid<0 ) ridBad = -rid;
672 else ridGood = rid;
673 }
674 db_multi_exec(
675
+2 -1
--- src/stash.c
+++ src/stash.c
@@ -726,12 +726,13 @@
726726
undo_save_stash(stashid);
727727
stash_drop(stashid);
728728
}
729729
undo_finish();
730730
}else{
731
+ stashid = stash_get_id(0);
731732
undo_begin();
732
- undo_save_stash(0);
733
+ undo_save_stash(stashid);
733734
stash_drop(stashid);
734735
undo_finish();
735736
}
736737
}else
737738
if( strncmp(zCmd, "pop", nCmd)==0 || strncmp(zCmd, "apply", nCmd)==0 ){
738739
--- src/stash.c
+++ src/stash.c
@@ -726,12 +726,13 @@
726 undo_save_stash(stashid);
727 stash_drop(stashid);
728 }
729 undo_finish();
730 }else{
 
731 undo_begin();
732 undo_save_stash(0);
733 stash_drop(stashid);
734 undo_finish();
735 }
736 }else
737 if( strncmp(zCmd, "pop", nCmd)==0 || strncmp(zCmd, "apply", nCmd)==0 ){
738
--- src/stash.c
+++ src/stash.c
@@ -726,12 +726,13 @@
726 undo_save_stash(stashid);
727 stash_drop(stashid);
728 }
729 undo_finish();
730 }else{
731 stashid = stash_get_id(0);
732 undo_begin();
733 undo_save_stash(stashid);
734 stash_drop(stashid);
735 undo_finish();
736 }
737 }else
738 if( strncmp(zCmd, "pop", nCmd)==0 || strncmp(zCmd, "apply", nCmd)==0 ){
739

Keyboard Shortcuts

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