From d675e99e4ab44907c26855abd9967bdc547dd57c Mon Sep 17 00:00:00 2001 From: Alexandre Friquet Date: Tue, 20 Aug 2024 11:10:11 +0200 Subject: [PATCH] Launch git bisect whithin top level folder. Needs to provide TEST_COMMAND with absolute path. --- lib/bummr/bisecter.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/bummr/bisecter.rb b/lib/bummr/bisecter.rb index 394ce8f..38b78c3 100644 --- a/lib/bummr/bisecter.rb +++ b/lib/bummr/bisecter.rb @@ -5,12 +5,14 @@ class Bisecter def bisect puts "Bad commits found! Bisecting...".color(:red) + toplevel_path = `git rev-parse --show-toplevel`.chomp + system("bundle") - system("git bisect start") - system("git bisect bad") - system("git bisect good #{BASE_BRANCH}") + system("git -C #{toplevel_path} bisect start") + system("git -C #{toplevel_path} bisect bad") + system("git -C #{toplevel_path} bisect good #{BASE_BRANCH}") - Open3.popen2e("git bisect run #{TEST_COMMAND}") do |_std_in, std_out_err| + Open3.popen2e("git -C #{toplevel_path} bisect run #{TEST_COMMAND}") do |_std_in, std_out_err| while line = std_out_err.gets puts line