Christian Couder | a2ad79c | 2009-03-26 05:55:24 +0100 | [diff] [blame] | 1 | #ifndef BISECT_H |
| 2 | #define BISECT_H |
| 3 | |
Elijah Newren | ef3ca95 | 2018-08-15 10:54:05 -0700 | [diff] [blame] | 4 | struct commit_list; |
Nguyễn Thái Ngọc Duy | 69d2cfe | 2018-11-10 06:48:59 +0100 | [diff] [blame] | 5 | struct repository; |
Elijah Newren | ef3ca95 | 2018-08-15 10:54:05 -0700 | [diff] [blame] | 6 | |
Martin Ågren | 24d707f | 2017-11-05 21:24:28 +0100 | [diff] [blame] | 7 | /* |
| 8 | * Find bisection. If something is found, `reaches` will be the number of |
| 9 | * commits that the best commit reaches. `all` will be the count of |
| 10 | * non-SAMETREE commits. If nothing is found, `list` will be NULL. |
| 11 | * Otherwise, it will be either all non-SAMETREE commits or the single |
| 12 | * best commit, as chosen by `find_all`. |
| 13 | */ |
Denton Liu | 5545442 | 2019-04-29 04:28:14 -0400 | [diff] [blame] | 14 | void find_bisection(struct commit_list **list, int *reaches, int *all, |
Aaron Lipman | ad464a4 | 2020-08-07 17:58:38 -0400 | [diff] [blame] | 15 | unsigned bisect_flags); |
Christian Couder | a2ad79c | 2009-03-26 05:55:24 +0100 | [diff] [blame] | 16 | |
Denton Liu | 5545442 | 2019-04-29 04:28:14 -0400 | [diff] [blame] | 17 | struct commit_list *filter_skipped(struct commit_list *list, |
Denton Liu | ad6dad0 | 2019-04-29 04:28:23 -0400 | [diff] [blame] | 18 | struct commit_list **tried, |
| 19 | int show_all, |
| 20 | int *count, |
| 21 | int *skipped_first); |
Christian Couder | 9518864 | 2009-03-26 05:55:49 +0100 | [diff] [blame] | 22 | |
Christian Couder | 37c4c38 | 2009-03-29 11:55:43 +0200 | [diff] [blame] | 23 | #define BISECT_SHOW_ALL (1<<0) |
Nguyễn Thái Ngọc Duy | 9899372 | 2012-02-28 21:00:00 +0700 | [diff] [blame] | 24 | #define REV_LIST_QUIET (1<<1) |
Christian Couder | 37c4c38 | 2009-03-29 11:55:43 +0200 | [diff] [blame] | 25 | |
Aaron Lipman | ad464a4 | 2020-08-07 17:58:38 -0400 | [diff] [blame] | 26 | #define FIND_BISECTION_ALL (1u<<0) |
| 27 | #define FIND_BISECTION_FIRST_PARENT_ONLY (1u<<1) |
| 28 | |
Christian Couder | d797257 | 2009-04-06 22:28:00 +0200 | [diff] [blame] | 29 | struct rev_list_info { |
| 30 | struct rev_info *revs; |
Nguyễn Thái Ngọc Duy | 9899372 | 2012-02-28 21:00:00 +0700 | [diff] [blame] | 31 | int flags; |
Christian Couder | d797257 | 2009-04-06 22:28:00 +0200 | [diff] [blame] | 32 | int show_timestamp; |
| 33 | int hdr_termination; |
| 34 | const char *header_prefix; |
| 35 | }; |
| 36 | |
Miriam Rubio | 680e8a0 | 2020-02-17 09:40:32 +0100 | [diff] [blame] | 37 | /* |
| 38 | * enum bisect_error represents the following return codes: |
| 39 | * BISECT_OK: success code. Internally, it means that next |
| 40 | * commit has been found (and possibly checked out) and it |
| 41 | * should be tested. |
| 42 | * BISECT_FAILED error code: default error code. |
Pranit Bauva | ce58b5d | 2020-02-17 09:40:34 +0100 | [diff] [blame] | 43 | * BISECT_ONLY_SKIPPED_LEFT error code: only skipped |
| 44 | * commits left to be tested. |
Pranit Bauva | 6c69f22 | 2020-02-17 09:40:39 +0100 | [diff] [blame] | 45 | * BISECT_MERGE_BASE_CHECK error code: merge base check failed. |
| 46 | * BISECT_NO_TESTABLE_COMMIT error code: no testable commit found. |
| 47 | * BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND early success code: |
| 48 | * first term_bad commit found. |
Pranit Bauva | cdd4dc2 | 2020-02-17 09:40:36 +0100 | [diff] [blame] | 49 | * BISECT_INTERNAL_SUCCESS_MERGE_BASE early success |
| 50 | * code: found merge base that should be tested. |
Pranit Bauva | 6c69f22 | 2020-02-17 09:40:39 +0100 | [diff] [blame] | 51 | * Early success codes BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND and |
| 52 | * BISECT_INTERNAL_SUCCESS_MERGE_BASE should be only internal codes. |
Miriam Rubio | 680e8a0 | 2020-02-17 09:40:32 +0100 | [diff] [blame] | 53 | */ |
| 54 | enum bisect_error { |
| 55 | BISECT_OK = 0, |
Pranit Bauva | ce58b5d | 2020-02-17 09:40:34 +0100 | [diff] [blame] | 56 | BISECT_FAILED = -1, |
Pranit Bauva | cdd4dc2 | 2020-02-17 09:40:36 +0100 | [diff] [blame] | 57 | BISECT_ONLY_SKIPPED_LEFT = -2, |
Pranit Bauva | 9ec598e | 2020-02-17 09:40:38 +0100 | [diff] [blame] | 58 | BISECT_MERGE_BASE_CHECK = -3, |
Pranit Bauva | 6c69f22 | 2020-02-17 09:40:39 +0100 | [diff] [blame] | 59 | BISECT_NO_TESTABLE_COMMIT = -4, |
| 60 | BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND = -10, |
Pranit Bauva | cdd4dc2 | 2020-02-17 09:40:36 +0100 | [diff] [blame] | 61 | BISECT_INTERNAL_SUCCESS_MERGE_BASE = -11 |
Miriam Rubio | 680e8a0 | 2020-02-17 09:40:32 +0100 | [diff] [blame] | 62 | }; |
| 63 | |
Aaron Lipman | be5fe20 | 2020-08-07 17:58:36 -0400 | [diff] [blame] | 64 | enum bisect_error bisect_next_all(struct repository *r, const char *prefix); |
Christian Couder | 1bf072e | 2009-03-26 05:55:54 +0100 | [diff] [blame] | 65 | |
Denton Liu | 5545442 | 2019-04-29 04:28:14 -0400 | [diff] [blame] | 66 | int estimate_bisect_steps(int all); |
Christian Couder | 1c87654 | 2009-04-19 11:55:38 +0200 | [diff] [blame] | 67 | |
Denton Liu | 5545442 | 2019-04-29 04:28:14 -0400 | [diff] [blame] | 68 | void read_bisect_terms(const char **bad, const char **good); |
Antoine Delaite | cb46d63 | 2015-06-29 17:40:30 +0200 | [diff] [blame] | 69 | |
Denton Liu | 5545442 | 2019-04-29 04:28:14 -0400 | [diff] [blame] | 70 | int bisect_clean_state(void); |
Pranit Bauva | fb71a32 | 2017-09-29 06:49:39 +0000 | [diff] [blame] | 71 | |
Christian Couder | a2ad79c | 2009-03-26 05:55:24 +0100 | [diff] [blame] | 72 | #endif |