]> asedeno.scripts.mit.edu Git - git.git/blobdiff - builtin-apply.c
Merge git://git.kernel.org/pub/scm/gitk/gitk
[git.git] / builtin-apply.c
index abe73a0f8194e95c2a10a27c2007560e6d57f3d5..1103625a4a923d92ca8d335d1a872236630541e5 100644 (file)
@@ -2247,7 +2247,7 @@ static int check_to_create_blob(const char *new_name, int ok_if_exists)
                 * In such a case, path "new_name" does not exist as
                 * far as git is concerned.
                 */
-               if (has_symlink_leading_path(new_name, NULL))
+               if (has_symlink_leading_path(strlen(new_name), new_name))
                        return 0;
 
                return error("%s: already exists in working directory", new_name);
@@ -2981,12 +2981,8 @@ static int apply_patch(int fd, const char *filename, int inaccurate_eof)
 
 static int git_apply_config(const char *var, const char *value)
 {
-       if (!strcmp(var, "apply.whitespace")) {
-               if (!value)
-                       return config_error_nonbool(var);
-               apply_default_whitespace = xstrdup(value);
-               return 0;
-       }
+       if (!strcmp(var, "apply.whitespace"))
+               return git_config_string(&apply_default_whitespace, var, value);
        return git_default_config(var, value);
 }
 
@@ -3121,7 +3117,7 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
 
                fd = open(arg, O_RDONLY);
                if (fd < 0)
-                       usage(apply_usage);
+                       die("can't open patch '%s': %s", arg, strerror(errno));
                read_stdin = 0;
                set_default_whitespace_mode(whitespace_option);
                errs |= apply_patch(fd, arg, inaccurate_eof);