Re: git bisect idea: Asymmetric split points

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linus Torvalds
Date: Sunday, October 8, 2006 - 5:19 pm

On Sun, 9 Oct 2006, Peter Osterlund wrote:

It should be very easy to implement.

See builtin-rev-list.c: find_bisection(), which has a _very_ simple way of 
trying to find the best commit. It just counts the distance from the 
commit:

	distance = count_distance(p);
	clear_distance(list);

where "distance" is really "how many commits will this cover".

If you wanted to get as close to (say) 75% of the total list of commits as 
possible, you should just do something like

	optimal = nr * percent / 100;
	how_close = abs(optimal - distance);
	if (how_close < closest) {
		best = p;
		closest = how_close;
	}

instead of what we do now (which is just to say that "since we want to get 
half-way, we want to make the biggest distance from _both_ 0 and from 
"nr", which is what it calculates with

 - If we're closer to "nr" than to 0 (ie the difference between nr and 
   distance is smaller than the difference between distance and 0), pick 
   the smaller difference:

	if (nr - distance < distance) 
		distance = nr - distance;

 - if this new distance is larger than any distance we've seen so far, 
   this is the best commit so far:

	if (distance > closest) {
		best = p;
		closest = distance;
	}

and notice how this is really just a special case of the percentage thing 
when percent is 50%.

			Linus
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
git bisect idea: Asymmetric split points, Peter Osterlund, (Sun Oct 8, 4:43 pm)
Re: git bisect idea: Asymmetric split points, Linus Torvalds, (Sun Oct 8, 5:19 pm)