Code

Demote git-p4import to contrib status.
[git.git] / setup.c
diff --git a/setup.c b/setup.c
index dba8012659cf85fa96cad4fcbc55e377c7e876b9..7b07144af7b0ea96eb2fcd65098331768e46ca3b 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -39,7 +39,7 @@ const char *prefix_path(const char *prefix, int len, const char *path)
        if (len) {
                int speclen = strlen(path);
                char *n = xmalloc(speclen + len + 1);
-       
+
                memcpy(n, prefix, len);
                memcpy(n + len, path, speclen+1);
                path = n;
@@ -47,7 +47,7 @@ const char *prefix_path(const char *prefix, int len, const char *path)
        return path;
 }
 
-/* 
+/*
  * Unlike prefix_path, this should be used if the named file does
  * not have to interact with index entry; i.e. name of a random file
  * on the filesystem.
@@ -211,7 +211,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
        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);
@@ -271,7 +271,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
                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) {
@@ -281,7 +281,7 @@ const char *setup_git_directory_gently(int *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");
@@ -340,7 +340,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
                        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);
@@ -364,6 +364,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
 int git_config_perm(const char *var, const char *value)
 {
        if (value) {
+               int i;
                if (!strcmp(value, "umask"))
                        return PERM_UMASK;
                if (!strcmp(value, "group"))
@@ -372,6 +373,9 @@ int git_config_perm(const char *var, const char *value)
                    !strcmp(value, "world") ||
                    !strcmp(value, "everybody"))
                        return PERM_EVERYBODY;
+               i = atoi(value);
+               if (i > 1)
+                       return i;
        }
        return git_config_bool(var, value);
 }