How do I get the current "status" of a git bisect? -


i making personal modifications oh-my-git (shows git status on terminal) , display "status" of current bisect. specifically, want number of remaining commits , approximate number of steps result of last bisect command, e.g.:

bisecting: 9 revisions left test after (roughly 3 steps)

it seems way obtain information executing git bisect good or git bisect bad. however, not want change state of repo running either of these commands - want obtain current bisect state.

completely naive answer based on extremely limited testing:

the range of commits left probe can obtained git bisect visualize, , can crudely counted git bisect visualize | wc -l or have you.

the message printed prior getting state appears based on half amount, , taking base 2 log of half.

for instance, i'm in state whereby told this:

bisecting: 10 revisions left test after (roughly 3 steps) 

and in state have:

$ git bisect visualize --oneline | wc -l 21 

i.e. "10 revisions" means there 21 commits in suspected range. in middle of range, 10 lie in either direction. 10, calculate 21/2, rounded down. "roughly 3 left test", take base 2 log of 10, rounded down.

in favorite scripting language (substitute yours):

$ txr -p '(let* ((count (length                           (get-lines                             (open-command "git bisect visualize --oneline"))))                  (left (trunc count 2)))             `bisecting: @left revisions left test after \             \ (roughly @(int-flo (log2 left)) steps)`)' bisecting: 10 revisions left test after (roughly 3 steps) 

some error handling needed since bisect command complain if haven't reported @ least 1 , 1 bad commit. there corner cases, avoiding log2 being applied zero, if can occur.