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

Re: [PATCH] git-init: set core.worktree if GIT_WORK_TREE is specified

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 4, 2007, 11:57 UTC
Message-ID
<Pine.LNX.4.64.0707041255510.4071@racer.site>
In-Reply-To
<468B793D.53661D60@eudaptics.com>
Hi,
On Wed, 4 Jul 2007, Johannes Sixt wrote:
Show 25 quoted lines
> Matthias Lederhofer wrote:
> > 
> > > +     if (!getcwd(cwd, sizeof(cwd)) || cwd[0] != '/')
> > > +             die("Unable to read current working directory");
> > 
> > Dscho just pointed out that this causes problems on windows.  The same
> > is also in setup_git_directory_gently and was there before I touched
> > it, introduced by Linus in d288a700.  What was the original reason to
> > do this?  Are there implementations of getcwd which return a relative
> > path?
> > 
> > Additionally there are other places which need to check if some user
> > supplied path is absolute.  Should we have a macro/function for that
> > which depends on the os and checks for path[0] = '/' on unix and
> > perhaps path[1] = ':' on windows?
> 
> I've modified some places (that check for an absolute path) in the MinGW
> port to read (path[0] == '/' || path[1] == ':'). I don't think that it's
> necessary that you cater for this case in your code - I'll take care of
> it in the MinGW port. Of course, a hint that there is another place to
> watch out for, or even better a test case in t/, is most appreciated.
> 
> I still hope to find some time to rework the MinGW port. Then such
> details will be hidden behind a is_path_absolute() function. Or maybe
> getcwd_or_die() ;)
Yes, but why not start early? is_path_absolute() makes perfect sense.

However, I was asking (out of lack of knowledge): is there any way getcwd() does not return an absolute path?

Ciao, Dscho

Previous: Johannes SixtNext: Linus Torvalds
Message 4 of 7 in “git-init: set core.worktree if GIT_WORK_TREE is specified”
  1. git-init: set core.worktree if GIT_WORK_TREE is specifiedMatthias Lederhofer, Jul 3, 2007
  2. Matthias LederhoferJul 4, 2007
  3. Johannes SixtJul 4, 2007
  4. Johannes SchindelinJul 4, 2007
  5. Linus TorvaldsJul 4, 2007
  6. Junio C HamanoJul 4, 2007
  7. Linus TorvaldsJul 4, 2007

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.