**diff options**

author | Christian Couder <chriscool@tuxfamily.org> | 2009-02-21 08:26:01 (GMT) |
---|---|---|

committer | Junio C Hamano <gitster@pobox.com> | 2009-03-04 08:56:52 (GMT) |

commit | 9f199b159580545c39716fd87038f8ff7cd0eace (patch) | |

tree | ae723c3c639361a74a7e8713dc1b724a55fe7751 /git-bisect.sh | |

parent | e752f4bba24afe964eb42d6c2b8bf06cc77c9ce4 (diff) | |

download | git-9f199b159580545c39716fd87038f8ff7cd0eace.zip git-9f199b159580545c39716fd87038f8ff7cd0eace.tar.gz git-9f199b159580545c39716fd87038f8ff7cd0eace.tar.bz2 |

rev-list: estimate number of bisection step left

This patch teaches "git rev-list --bisect-vars" to output an estimate
of the number of bisection step left _after the current one_ along with
the other variables it already outputs.
This patch also makes "git-bisect.sh" display this number of steps left
_after the current one_, along with the estimate of the number of
revisions left to test (after the current one).
Here is a table to help analyse what should be the best estimate for
the number of bisect steps left.
N : linear case --> probabilities --> best
-------------------------------------------------------------
1 : G-B --> 0 --> 0
2 : G-U1-B --> 0 --> 0
3 : G-U1-U2-B --> 0(1/3) 1(2/3) --> 1
4 : G-U1-U2-U3-B --> 1 --> 1
5 : G-U1-U2-U3-U4-B --> 1(3/5) 2(2/5) --> 1
6 : G-U1-U2-U3-U4-U5-B --> 1(2/6) 2(4/6) --> 2
7 : G-U1-U2-U3-U4-U5-U6-B --> 1(1/7) 2(6/7) --> 2
8 : G-U1-U2-U3-U4-U5-U6-U7-B --> 2 --> 2
9 : G-U1-U2-U3-U4-U5-U6-U7-U8-B --> 2(7/9) 3(2/9) --> 2
10: G-U1-U2-U3-U4-U5-U6-U7-U8-U9-B --> 2(6/10)3(4/10)--> 2
In the column "N", there is the number of revisions that could _now_
be the first bad commit we are looking for.
The "linear case" column describes the linear history corresponding to
the number in column N. G means good, B means bad, and Ux means
unknown. Note that the first bad revision we are looking for can be
any Ux or B.
In the "probabilities" column, there are the different outcomes in
number of steps with the odds of each outcome in parenthesis
corresponding to the linear case.
The "best" column gives the most accurate estimate among the different
outcomes in the "probabilities" column.
We have the following:
best(2^n) == n - 1
and for any x between 0 included and 2^n excluded, the probability for
n - 1 steps left looks like:
P(2^n + x) == (2^n - x) / (2^n + x)
and P(2^n + x) < 0.5 means 2^n < 3x
So the algorithm used in this patch calculates 2^n and x, and then
choose between returning n - 1 and n.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Diffstat (limited to 'git-bisect.sh')

-rwxr-xr-x | git-bisect.sh | 2 |

1 files changed, 1 insertions, 1 deletions

diff --git a/git-bisect.sh b/git-bisect.sh index 10ad340..e313bde 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -512,7 +512,7 @@ bisect_next() { # commit is also a "skip" commit (see above). exit_if_skipped_commits "$bisect_rev" - bisect_checkout "$bisect_rev" "$bisect_nr revisions left to test after this" + bisect_checkout "$bisect_rev" "$bisect_nr revisions left to test after this (roughly $bisect_steps steps)" } bisect_visualize() { |