🌐 AI搜索 & 代理 主页
blob: ee3fd65f3bdb89611d7575239ee79e8c50bcd703 [file] [log] [blame]
Christian Coudera2ad79c2009-03-26 04:55:241#ifndef BISECT_H
2#define BISECT_H
3
Elijah Newrenef3ca952018-08-15 17:54:054struct commit_list;
Nguyễn Thái Ngọc Duy69d2cfe2018-11-10 05:48:595struct repository;
René Scharfe48af1fd2022-01-18 12:46:326struct object_id;
Elijah Newrenef3ca952018-08-15 17:54:057
Martin Ågren24d707f2017-11-05 20:24:288/*
9 * Find bisection. If something is found, `reaches` will be the number of
10 * commits that the best commit reaches. `all` will be the count of
11 * non-SAMETREE commits. If nothing is found, `list` will be NULL.
12 * Otherwise, it will be either all non-SAMETREE commits or the single
13 * best commit, as chosen by `find_all`.
14 */
Denton Liu55454422019-04-29 08:28:1415void find_bisection(struct commit_list **list, int *reaches, int *all,
Aaron Lipmanad464a42020-08-07 21:58:3816 unsigned bisect_flags);
Christian Coudera2ad79c2009-03-26 04:55:2417
Denton Liu55454422019-04-29 08:28:1418struct commit_list *filter_skipped(struct commit_list *list,
Denton Liuad6dad02019-04-29 08:28:2319 struct commit_list **tried,
20 int show_all,
21 int *count,
22 int *skipped_first);
Christian Couder95188642009-03-26 04:55:4923
Christian Couder37c4c382009-03-29 09:55:4324#define BISECT_SHOW_ALL (1<<0)
Nguyễn Thái Ngọc Duy98993722012-02-28 14:00:0025#define REV_LIST_QUIET (1<<1)
Christian Couder37c4c382009-03-29 09:55:4326
Aaron Lipmanad464a42020-08-07 21:58:3827#define FIND_BISECTION_ALL (1u<<0)
28#define FIND_BISECTION_FIRST_PARENT_ONLY (1u<<1)
29
Christian Couderd7972572009-04-06 20:28:0030struct rev_list_info {
31 struct rev_info *revs;
Nguyễn Thái Ngọc Duy98993722012-02-28 14:00:0032 int flags;
Christian Couderd7972572009-04-06 20:28:0033 int show_timestamp;
34 int hdr_termination;
35 const char *header_prefix;
36};
37
Miriam Rubio680e8a02020-02-17 08:40:3238/*
39 * enum bisect_error represents the following return codes:
40 * BISECT_OK: success code. Internally, it means that next
41 * commit has been found (and possibly checked out) and it
42 * should be tested.
43 * BISECT_FAILED error code: default error code.
Pranit Bauvace58b5d2020-02-17 08:40:3444 * BISECT_ONLY_SKIPPED_LEFT error code: only skipped
45 * commits left to be tested.
Pranit Bauva6c69f222020-02-17 08:40:3946 * BISECT_MERGE_BASE_CHECK error code: merge base check failed.
47 * BISECT_NO_TESTABLE_COMMIT error code: no testable commit found.
48 * BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND early success code:
49 * first term_bad commit found.
Pranit Bauvacdd4dc22020-02-17 08:40:3650 * BISECT_INTERNAL_SUCCESS_MERGE_BASE early success
51 * code: found merge base that should be tested.
Pranit Bauva6c69f222020-02-17 08:40:3952 * Early success codes BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND and
53 * BISECT_INTERNAL_SUCCESS_MERGE_BASE should be only internal codes.
Miriam Rubio680e8a02020-02-17 08:40:3254 */
55enum bisect_error {
56 BISECT_OK = 0,
Pranit Bauvace58b5d2020-02-17 08:40:3457 BISECT_FAILED = -1,
Pranit Bauvacdd4dc22020-02-17 08:40:3658 BISECT_ONLY_SKIPPED_LEFT = -2,
Pranit Bauva9ec598e2020-02-17 08:40:3859 BISECT_MERGE_BASE_CHECK = -3,
Pranit Bauva6c69f222020-02-17 08:40:3960 BISECT_NO_TESTABLE_COMMIT = -4,
61 BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND = -10,
Pranit Bauvacdd4dc22020-02-17 08:40:3662 BISECT_INTERNAL_SUCCESS_MERGE_BASE = -11
Miriam Rubio680e8a02020-02-17 08:40:3263};
64
Chris Down0cf1def2022-05-11 18:00:0965/*
66 * Stores how many good/bad commits we have stored for a bisect. nr_bad can
67 * only be 0 or 1.
68 */
69struct bisect_state {
70 unsigned int nr_good;
71 unsigned int nr_bad;
72};
73
Aaron Lipmanbe5fe202020-08-07 21:58:3674enum bisect_error bisect_next_all(struct repository *r, const char *prefix);
Christian Couder1bf072e2009-03-26 04:55:5475
Denton Liu55454422019-04-29 08:28:1476int estimate_bisect_steps(int all);
Christian Couder1c876542009-04-19 09:55:3877
Denton Liu55454422019-04-29 08:28:1478void read_bisect_terms(const char **bad, const char **good);
Antoine Delaitecb46d632015-06-29 15:40:3079
Denton Liu55454422019-04-29 08:28:1480int bisect_clean_state(void);
Pranit Bauvafb71a322017-09-29 06:49:3981
René Scharfe48af1fd2022-01-18 12:46:3282enum bisect_error bisect_checkout(const struct object_id *bisect_rev,
83 int no_checkout);
84
Christian Coudera2ad79c2009-03-26 04:55:2485#endif