git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git bisect idea: Asymmetric split points

From
Linus Torvalds <torvalds@osdl.org>
Date
Oct 9, 2006, 00:19 UTC
Message-ID
<Pine.LNX.4.64.0610081711370.3952@g5.osdl.org>
In-Reply-To
<m38xjqfk6r.fsf@telia.com>
On Sun, 9 Oct 2006, Peter Osterlund wrote:
> 
> Does this sound like a good idea? Would it be hard to implement?
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
Previous: Peter Osterlund
Message 2 of 2 in “git bisect idea: Asymmetric split points”
  1. Peter OsterlundOct 8, 2006
  2. Linus TorvaldsOct 9, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.