Thread (5 messages) flat view 5 messages, 4 authors, 2016-06-15

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

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2016-06-15 22:43:19


On Wed, 4 Jul 2007, Matthias Lederhofer wrote:
quoted
+	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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help