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
Linus Torvalds <torvalds@linux-foundation.org>
Date
Jul 4, 2007, 16:23 UTC
Message-ID
<alpine.LFD.0.98.0707040920520.9434@woody.linux-foundation.org>
In-Reply-To
<20070704092915.GA18597@moooo.ath.cx>
On Wed, 4 Jul 2007, Matthias Lederhofer wrote:
Show 8 quoted lines
> > +	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?
Just remove the check for cwd[0] being '/'.

It's just me being too kernel-oriented - inside the kernel, a d_path() return value pathname can be either a real path, or something like "pipe:[8003]", and the difference is the '/' at the beginning.

In user space, and for getcwd(), the check doesn't make sense. So please just remove it, and sorry for my idiotic "I've worked with the kernel for too damn long" programming mistakes.

		Linus
Previous: Johannes SchindelinNext: Junio C Hamano
Message 5 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.