Skip to content

Commit 4c41fa1

Browse files
committed
Handle multiple bisect candidates in Bisection.pm6
Because this logic will be needed everywhere.
1 parent a7ddc02 commit 4c41fa1

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

lib/Whateverable/Bisection.pm6

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ sub run-bisect(&runner = &standard-runner, #← Something to run on every revi
5858
$first-new-commit = ~$0;
5959
last
6060
}
61+
if $status == 2 {
62+
my $good-revs = get-output(:cwd($repo-cwd), <git for-each-ref>,
63+
--format=%(objectname), refs/bisect/old-*)<output>;
64+
my @possible-revs = get-output(:cwd($repo-cwd), <git rev-list>,
65+
<refs/bisect/new --not>, |$good-revs.lines)<output>.lines;
66+
$first-new-commit = @possible-revs;
67+
last
68+
}
6169
last if $status0;
6270
LAST take $result<output>
6371
}

xbin/Bisectable.p6

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,8 @@ method process($msg, $code, $old, $new) {
179179
description => $msg.server.current-nick,
180180
public => !%*ENV<DEBUGGABLE>;
181181

182-
if $bisect-status == 2 {
183-
my $good-revs = get-output(:cwd($repo-cwd), <git for-each-ref>,
184-
--format=%(objectname), refs/bisect/old-*)<output>;
185-
my @possible-revs = get-output(:cwd($repo-cwd), <git rev-list>,
186-
<refs/bisect/new --not>, |$good-revs.lines)<output>.lines;
187-
grumble There are {+@possible-revs} candidates for the
182+
if $bisect-result<first-new-commit>.list > 1 {
183+
grumble There are {+$bisect-result<first-new-commit>} candidates for the
188184
~ first “new” revision. See the log for more details
189185
}
190186
if $bisect-status0 {

0 commit comments

Comments
 (0)