]> asedeno.scripts.mit.edu Git - git.git/blobdiff - builtin-apply.c
Merge branch 'xx/db-refspec-vs-js-remote'
[git.git] / builtin-apply.c
index b415daf07edacacd8bda0527bb5ed229be91c861..b52aa20cfaea76f957741d32240a6cb6e161d60e 100644 (file)
@@ -2360,7 +2360,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(strlen(new_name), new_name))
+               if (has_symlink_leading_path(new_name, strlen(new_name)))
                        return 0;
 
                return error("%s: already exists in working directory", new_name);
@@ -2441,7 +2441,7 @@ static int check_preimage(struct patch *patch, struct cache_entry **ce, struct s
                return error("%s: %s", old_name, strerror(errno));
        }
 
-       if (!cached)
+       if (!cached && !tpatch)
                st_mode = ce_mode_from_stat(*ce, st->st_mode);
 
        if (patch->is_new < 0)
@@ -2453,7 +2453,7 @@ static int check_preimage(struct patch *patch, struct cache_entry **ce, struct s
        if (st_mode != patch->old_mode)
                fprintf(stderr, "warning: %s has type %o, expected %o\n",
                        old_name, st_mode, patch->old_mode);
-       if (!patch->new_mode)
+       if (!patch->new_mode && !patch->is_delete)
                patch->new_mode = st_mode;
        return 0;
 
@@ -3212,7 +3212,7 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
 
        struct option builtin_apply_options[] = {
                { OPTION_CALLBACK, 0, "exclude", NULL, "path",
-                       "donยดt apply changes matching the given path",
+                       "don't apply changes matching the given path",
                        0, option_parse_exclude },
                { OPTION_CALLBACK, 0, "include", NULL, "path",
                        "apply changes matching the given path",
@@ -3224,10 +3224,10 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
                        "ignore additions made by the patch"),
                OPT_BOOLEAN(0, "stat", &diffstat,
                        "instead of applying the patch, output diffstat for the input"),
-               OPT_BOOLEAN(0, "allow-binary-replacement", &binary,
-                       "now no-op"),
-               OPT_BOOLEAN(0, "binary", &binary,
-                       "now no-op"),
+               { OPTION_BOOLEAN, 0, "allow-binary-replacement", &binary,
+                 NULL, "old option, now no-op", PARSE_OPT_HIDDEN },
+               { OPTION_BOOLEAN, 0, "binary", &binary,
+                 NULL, "old option, now no-op", PARSE_OPT_HIDDEN },
                OPT_BOOLEAN(0, "numstat", &numstat,
                        "shows number of added and deleted lines in decimal notation"),
                OPT_BOOLEAN(0, "summary", &summary,