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.
Commit
1259da6d3dd4e9fda3b2de601ee7cbf8dea7e6a700d6f5e65d2528cee43c5dbe
Parent
2959c054f7d1b7a…
2 files changed
+9
+2
-1
+9
| --- src/bisect.c | ||
| +++ src/bisect.c | ||
| @@ -20,10 +20,13 @@ | ||
| 20 | 20 | ** changes that have occurred across multiple check-ins. |
| 21 | 21 | */ |
| 22 | 22 | #include "config.h" |
| 23 | 23 | #include "bisect.h" |
| 24 | 24 | #include <assert.h> |
| 25 | +#if !defined(_WIN32) | |
| 26 | +# include <sys/wait.h> | |
| 27 | +#endif | |
| 25 | 28 | |
| 26 | 29 | /* |
| 27 | 30 | ** Local variables for this module |
| 28 | 31 | */ |
| 29 | 32 | static struct { |
| @@ -447,10 +450,15 @@ | ||
| 447 | 450 | int rc; |
| 448 | 451 | Blob cmd; |
| 449 | 452 | blob_init(&cmd, 0, 0); |
| 450 | 453 | blob_append_escaped_arg(&cmd, g.nameOfExe, 1); |
| 451 | 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 | |
| 452 | 460 | if( isInteractive ){ |
| 453 | 461 | Blob in; |
| 454 | 462 | fossil_print("test-command result: %d\n", rc); |
| 455 | 463 | while(1){ |
| 456 | 464 | int n; |
| @@ -656,10 +664,11 @@ | ||
| 656 | 664 | } |
| 657 | 665 | blob_rewind(&log); |
| 658 | 666 | for(i=0; i<cnt-1; i++){ |
| 659 | 667 | int rid; |
| 660 | 668 | blob_token(&log, &id); |
| 669 | + if( blob_str(&id)[0]=='s' ) continue /* a skip */; | |
| 661 | 670 | rid = atoi(blob_str(&id)); |
| 662 | 671 | if( rid<0 ) ridBad = -rid; |
| 663 | 672 | else ridGood = rid; |
| 664 | 673 | } |
| 665 | 674 | db_multi_exec( |
| 666 | 675 |
| --- 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 @@ | ||
| 726 | 726 | undo_save_stash(stashid); |
| 727 | 727 | stash_drop(stashid); |
| 728 | 728 | } |
| 729 | 729 | undo_finish(); |
| 730 | 730 | }else{ |
| 731 | + stashid = stash_get_id(0); | |
| 731 | 732 | undo_begin(); |
| 732 | - undo_save_stash(0); | |
| 733 | + undo_save_stash(stashid); | |
| 733 | 734 | stash_drop(stashid); |
| 734 | 735 | undo_finish(); |
| 735 | 736 | } |
| 736 | 737 | }else |
| 737 | 738 | if( strncmp(zCmd, "pop", nCmd)==0 || strncmp(zCmd, "apply", nCmd)==0 ){ |
| 738 | 739 |
| --- 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 |