summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 73616fd)
raw | patch | inline | side by side (parent: 73616fd)
author | Junio C Hamano <gitster@pobox.com> | |
Wed, 4 Jul 2007 19:45:42 +0000 (12:45 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 4 Jul 2007 19:45:42 +0000 (12:45 -0700) |
In user space, and for getcwd(), the check to see if the
resulting path begins with a '/' does not make sense. This is
merely a mistake by Linus who is so used to code for the kernel,
where 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.
Pointed out by Dscho, Matthias Lederhofer and clarified by Linus.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
resulting path begins with a '/' does not make sense. This is
merely a mistake by Linus who is so used to code for the kernel,
where 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.
Pointed out by Dscho, Matthias Lederhofer and clarified by Linus.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
setup.c | patch | blob | history |
index 01f74d4644c35862b2498ee8534213b2d76bf721..bb26f3af96da2a257d020c87760fa6dc74e8f1d7 100644 (file)
--- a/setup.c
+++ b/setup.c
if (!gitdirenv) {
int len, offset;
- if (!getcwd(cwd, sizeof(cwd)-1) || cwd[0] != '/')
+ if (!getcwd(cwd, sizeof(cwd)-1))
die("Unable to read current working directory");
offset = len = strlen(cwd);
die("Not a git repository: '%s'", gitdirenv);
}
- if (!getcwd(cwd, sizeof(cwd)-1) || cwd[0] != '/')
+ if (!getcwd(cwd, sizeof(cwd)-1))
die("Unable to read current working directory");
if (chdir(gitdirenv)) {
if (nongit_ok) {
die("Cannot change directory to $%s '%s'",
GIT_DIR_ENVIRONMENT, gitdirenv);
}
- if (!getcwd(gitdir, sizeof(gitdir)-1) || gitdir[0] != '/')
+ if (!getcwd(gitdir, sizeof(gitdir)-1))
die("Unable to read current working directory");
if (chdir(cwd))
die("Cannot come back to cwd");
die("Cannot change directory to working tree '%s'",
gitworktree);
}
- if (!getcwd(worktree, sizeof(worktree)-1) || worktree[0] != '/')
+ if (!getcwd(worktree, sizeof(worktree)-1))
die("Unable to read current working directory");
strcat(worktree, "/");
inside_work_tree = !prefixcmp(cwd, worktree);