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

Re: Bisect needing to be at repo top-level?

From
Stefan Beller <stefanbeller@googlemail.com>
Date
Oct 9, 2013, 19:01 UTC
Message-ID
<5255A7FA.8090504@googlemail.com>
In-Reply-To
<20131009185459.GA2823@sigill.intra.peff.net>
On 10/09/2013 08:55 PM, Jeff King wrote:
Show 31 quoted lines
> On Wed, Oct 09, 2013 at 08:27:58PM +0200, Stefan Beller wrote:
> 
>>> At least on Linux, if you checkout a revision with "foo/" directory,
>>> chdir to it and then checkout a revision with "foo" file to nuke
>>> your current place, I know "git checkout" will happily do so and you
>>> will still be in a directory that is connected nowhere.  Your ".."
>>> is probably pointing at the top-level, but there is no reverse, so
>>> "cd ../foo" may or may not work from that state, and it would lead
>>> to an interesting confusion.
>>>
>>> We may want to check the condition and forbid such a checkout.
>>
>> I think forbidding such a checkout is a bit hard:
>> 	$ git checkout <branch>
>> 	fatal: checkout not possible, because of said reason (dangling pwd)
>> 	$ cd ../.. # go to top level or somewhere else unaffected
>> 	$ git checkout <branch> # this will work
>>
>> Wouldn't it be better to navigate to the 'nearest' possible working dir on checkout?
>> Such a workflow would emerge:
>> 	$ git checkout <branch> # this includes the "cd .." of the previous step, it just went the dir structure up, until a valid dir was found.
>> 	warning: the current working directory is not part of the tree, navigating to $(PWD)
> 
> The problem is that the program calling "git checkout" (e.g., the shell)
> is in the directory that is going away, and git cannot impact the
> working directory of its parent. So there is no way to "fix" it here.
> Our only options are to proceed and hope the user can figure it out, or
> to warn/forbid.
> 
> -Peff
> 
Oops my bad. I did not think this through.

Maybe we could still have a config option, which either forbids it, or just shows a warning. I'll try to familiarize with the code and see what I can do.

Stefan
Previous: Jeff KingNext: Burton, Ross
Message 10 of 11 in “Bisect needing to be at repo top-level?”
  1. Burton, RossSep 17, 2013
  2. Junio C HamanoSep 17, 2013
  3. Lukas FleischerSep 17, 2013
  4. Junio C HamanoSep 17, 2013
  5. Ben AvelingSep 19, 2013
  6. Ben AvelingSep 19, 2013
  7. Junio C HamanoSep 19, 2013
  8. Stefan BellerOct 9, 2013
  9. Jeff KingOct 9, 2013
  10. Stefan BellerOct 9, 2013
  11. Burton, RossSep 17, 2013

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.