X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=setup.c;h=e3781b656d77be94e04c5229e6a190c5fc496490;hb=0ded47581aa6097f1a685443d3c2fc0cebaf8c3c;hp=6c2deda18492acb5a8597563d6843f9d0dd232c0;hpb=dfe50511c7e5ec2bc771c9a5f4c3318332a7744e;p=git.git diff --git a/setup.c b/setup.c index 6c2deda18..e3781b656 100644 --- a/setup.c +++ b/setup.c @@ -81,7 +81,7 @@ void verify_filename(const char *prefix, const char *arg) if (errno == ENOENT) die("ambiguous argument '%s': unknown revision or path not in the working tree.\n" "Use '--' to separate paths from revisions", arg); - die("'%s': %s", arg, strerror(errno)); + die_errno("failed to stat '%s'", arg); } /* @@ -103,7 +103,7 @@ void verify_non_filename(const char *prefix, const char *arg) die("ambiguous argument '%s': both revision and filename\n" "Use '--' to separate filenames from revisions", arg); if (errno != ENOENT && errno != ENOTDIR) - die("'%s': %s", arg, strerror(errno)); + die_errno("failed to stat '%s'", arg); } const char **get_pathspec(const char *prefix, const char **pathspec) @@ -257,7 +257,7 @@ const char *read_gitfile_gently(const char *path) return NULL; fd = open(path, O_RDONLY); if (fd < 0) - die("Error opening %s: %s", path, strerror(errno)); + die_errno("Error opening '%s'", path); buf = xmalloc(st.st_size + 1); len = read_in_full(fd, buf, st.st_size); close(fd); @@ -327,7 +327,7 @@ const char *setup_git_directory_gently(int *nongit_ok) return NULL; set_git_dir(make_absolute_path(gitdirenv)); if (chdir(work_tree_env) < 0) - die ("Could not chdir to %s", work_tree_env); + die_errno ("Could not chdir to '%s'", work_tree_env); strcat(buffer, "/"); return retval; } @@ -339,7 +339,7 @@ const char *setup_git_directory_gently(int *nongit_ok) } if (!getcwd(cwd, sizeof(cwd)-1)) - die("Unable to read current working directory"); + die_errno("Unable to read current working directory"); ceil_offset = longest_ancestor_length(cwd, env_ceiling_dirs); if (ceil_offset < 0 && has_dos_drive_prefix(cwd)) @@ -382,14 +382,14 @@ const char *setup_git_directory_gently(int *nongit_ok) if (offset <= ceil_offset) { if (nongit_ok) { if (chdir(cwd)) - die("Cannot come back to cwd"); + die_errno("Cannot come back to cwd"); *nongit_ok = 1; return NULL; } die("Not a git repository (or any of the parent directories): %s", DEFAULT_GIT_DIR_ENVIRONMENT); } if (chdir("..")) - die("Cannot change to %s/..: %s", cwd, strerror(errno)); + die_errno("Cannot change to '%s/..'", cwd); } inside_git_dir = 0; @@ -434,7 +434,7 @@ int git_config_perm(const char *var, const char *value) /* * Treat values 0, 1 and 2 as compatibility cases, otherwise it is - * a chmod value. + * a chmod value to restrict to. */ switch (i) { case PERM_UMASK: /* 0 */ @@ -456,7 +456,7 @@ int git_config_perm(const char *var, const char *value) * Mask filemode value. Others can not get write permission. * x flags for directories are handled separately. */ - return i & 0666; + return -(i & 0666); } int check_repository_format_version(const char *var, const char *value, void *cb) @@ -493,10 +493,10 @@ const char *setup_git_directory(void) static char buffer[PATH_MAX + 1]; char *rel; if (retval && chdir(retval)) - die ("Could not jump back into original cwd"); + die_errno ("Could not jump back into original cwd"); rel = get_relative_cwd(buffer, PATH_MAX, get_git_work_tree()); if (rel && *rel && chdir(get_git_work_tree())) - die ("Could not jump to working directory"); + die_errno ("Could not jump to working directory"); return rel && *rel ? strcat(rel, "/") : NULL; }