If there are no commits that can be valid bisection point, just terminate search for bisection point early. Firstly, it just wastes time, secondly with more complex computations for stochastic bisection we would have to deal with this special corner-case unnecessarily. Signed-off-by: Jan Kara <jack@xxxxxxx> --- bisect.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bisect.c b/bisect.c index dd2f6b68ae3d..3a26255e8650 100644 --- a/bisect.c +++ b/bisect.c @@ -453,12 +453,15 @@ void find_bisection(struct commit_list **commit_list, int *reaches, nr++; on_list++; } + *all = nr; + if (!nr) { + *reaches = 0; + goto out_weights; + } weights = setup_commit_weight_array(list, on_list); list = reverse_list(list); show_list("bisection 2 sorted", 0, nr, list); - *all = nr; - /* Do the real work of finding bisection commit. */ best = do_find_bisection(list, nr, bisect_flags); if (best) { @@ -472,6 +475,7 @@ void find_bisection(struct commit_list **commit_list, int *reaches, } free(weights); *commit_list = best; +out_weights: clear_commit_weight(&commit_weight); } -- 2.26.2