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

Re: git-bisect working only from toplevel dir

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 23, 2011, 20:45 UTC
Message-ID
<7vzkfma7q9.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20111123192329.GA21630@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 13 quoted lines
> On Wed, Nov 23, 2011 at 11:09:29AM -0800, Junio C Hamano wrote:
>
>> As to the approach, I suspect that it would be far better if it made
>> workable with cd_to_toplevel at the beginning, instead of saying
>> SUBDIRECTORY_OK.
>> 
>> After all, the current directory may disappear during the course of
>> bisection, upon checking out a revision that did not have the directory
>> you started your bisection from.
>
> But from what directory would you expect:
>
>   git bisect run make

My usual way to enlighten somebody is by forcing him/her to think the consequences, but because you did the thinking for the OP in this thread instead, it didn't work. Makes me somewhat sad ;-<.

> If we cd_to_toplevel, we can remember the prefix that we started from
> and cd to it before running the user's command, but there is no
> guarantee that it actually exists. Maybe that commit should be
> considered indeterminate then?
Yeah that sounds like a reasonable thing to do.
> I dunno. I haven't thought that hard about it. But I don't think it's
> quite as simple as just telling bisect it's OK to run from a subdir.

Absolutely. Saying SUBDIRECTORY_OK without thinking about the consequence through is a good discussion starter but is not a good patch.

Also didn't we make bisect workable in a bare repository recently? So the start-up sequence has to be something more elaborate like...

        . git-sh-setup
        if we are in a bare repository
        then
         	: we are happy...nothing funky needs to be done
	elif we are not in a working tree
		barf
	elif we are not at the top
        	prefix=$(git rev-parse --show-prefix)
		cd_to_toplevel
	fi

and then inside bisect_next() you would check if $prefix exists, and go there to run bisect--helper (or fail to go there and say "cannot test").

Previous: Jeff KingNext: Peter Baumann
Message 8 of 11 in “git-bisect working only from toplevel dir”
  1. Adam BorowskiNov 23, 2011
  2. Junio C HamanoNov 23, 2011
  3. Jeff KingNov 23, 2011
  4. Adam BorowskiNov 23, 2011
  5. Jeff KingNov 23, 2011
  6. Peter BaumannNov 23, 2011
  7. Jeff KingNov 23, 2011
  8. Junio C HamanoNov 23, 2011
  9. Peter BaumannNov 24, 2011
  10. Junio C HamanoNov 24, 2011
  11. Jeff KingNov 29, 2011

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.