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

Re: [PATCH v2] Add support for GIT_CEILING_DIRS

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
May 15, 2008, 17:45 UTC
Message-ID
<alpine.DEB.1.00.0805151841040.30431@racer>
In-Reply-To
<482C644F.9090903@facebook.com>
Hi,
On Thu, 15 May 2008, David Reiss wrote:
Show 14 quoted lines
> The problem with this implementation is that it does not distinguish 
> between GIT_CEILING_DIRS being unset and GIT_CEILING_DIRS="/".  For 
> example...
> 
> cd /
> sudo git init
> cd /home
> git rev-parse --show-prefix
> 
> That series of commands works with either version of my patch, but fails 
> with "fatal: Not a git repository" if I apply this change.  I am 
> certainly open to changing this code, but I think we will always need 
> two separate values of ceil_offset to represent "unset" and "/". It's 
> just a question of whether they should be -1 and 0 or 0 and 1.

You are much more familiar with the code, but I suspect that a simple change would fix that:

> >> +             do { } while (offset > ceil_offset && cwd[--offset] != '/');

Just use "--offset >= 0 && cwd[--offset] != '/'" here. And maybe ceil_offset = -1 again.

I cannot quickly test, since I am short on time, and it would be too cumbersome to find which patches to apply first.

But I strongly believe that it is not beyond your capabilities to adjust Hannes' patch for your command series, keeping the elegance.

Ciao, Dscho

Previous: David Reiss
Message 7 of 7 in “Add support for GIT_CEILING_DIRS”
  1. Add support for GIT_CEILING_DIRSDavid Reiss, May 15, 2008
  2. Johannes SixtMay 15, 2008
  3. David ReissMay 15, 2008
  4. Johannes SixtMay 15, 2008
  5. Johannes SchindelinMay 15, 2008
  6. David ReissMay 15, 2008
  7. Johannes SchindelinMay 15, 2008

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.