bisect: introduce first-parent flag

Upon seeing a merge commit when bisecting, this option may be used to
follow only the first parent.

In detecting regressions introduced through the merging of a branch, the
merge commit will be identified as introduction of the bug and its
ancestors will be ignored.

This option is particularly useful in avoiding false positives when a
merged branch contained broken or non-buildable commits, but the merge
itself was OK.

Signed-off-by: Aaron Lipman <alipman88@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Aaron Lipman
2020-08-07 17:58:37 -04:00
committed by Junio C Hamano
parent be5fe2000d
commit e8861ffc20
4 changed files with 42 additions and 3 deletions

View File

@ -15,6 +15,7 @@
#include "commit-slab.h"
#include "commit-reach.h"
#include "object-store.h"
#include "dir.h"
static struct oid_array good_revs;
static struct oid_array skipped_revs;
@ -460,6 +461,7 @@ static GIT_PATH_FUNC(git_path_bisect_run, "BISECT_RUN")
static GIT_PATH_FUNC(git_path_bisect_start, "BISECT_START")
static GIT_PATH_FUNC(git_path_bisect_log, "BISECT_LOG")
static GIT_PATH_FUNC(git_path_bisect_terms, "BISECT_TERMS")
static GIT_PATH_FUNC(git_path_bisect_first_parent, "BISECT_FIRST_PARENT")
static GIT_PATH_FUNC(git_path_head_name, "head-name")
static void read_bisect_paths(struct argv_array *array)
@ -998,7 +1000,7 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix)
struct object_id *bisect_rev;
char *steps_msg;
int no_checkout = ref_exists("BISECT_HEAD");
int first_parent_only = 0; /* TODO: pass --first-parent flag from git bisect start */
int first_parent_only = file_exists(git_path_bisect_first_parent());
read_bisect_terms(&term_bad, &term_good);
if (read_bisect_refs())
@ -1142,6 +1144,7 @@ int bisect_clean_state(void)
unlink_or_warn(git_path_bisect_names());
unlink_or_warn(git_path_bisect_run());
unlink_or_warn(git_path_bisect_terms());
unlink_or_warn(git_path_bisect_first_parent());
/* Cleanup head-name if it got left by an old version of git-bisect */
unlink_or_warn(git_path_head_name());
/*