am: suppress apply errors when using 3-way
[gitweb.git] / builtin-rm.c
index 3d03da09df0b2831dd5a6bcbc09e75db356260a1..0cc491271846214d73d55a4f528c8854e0460c8f 100644 (file)
@@ -59,8 +59,7 @@ static int check_local_mod(unsigned char *head, int index_only)
 
                if (lstat(ce->name, &st) < 0) {
                        if (errno != ENOENT)
-                               fprintf(stderr, "warning: '%s': %s",
-                                       ce->name, strerror(errno));
+                               warning("'%s': %s", ce->name, strerror(errno));
                        /* It already vanished from the working tree */
                        continue;
                }
@@ -115,7 +114,7 @@ static int check_local_mod(unsigned char *head, int index_only)
                 * "intent to add" entry.
                 */
                if (local_changes && staged_changes) {
-                       if (!index_only || !is_empty_blob_sha1(ce->sha1))
+                       if (!index_only || !(ce->ce_flags & CE_INTENT_TO_ADD))
                                errs = error("'%s' has staged content different "
                                             "from both the file and the HEAD\n"
                                             "(use -f to force removal)", name);
@@ -158,7 +157,8 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
 
        git_config(git_default_config, NULL);
 
-       argc = parse_options(argc, argv, builtin_rm_options, builtin_rm_usage, 0);
+       argc = parse_options(argc, argv, prefix, builtin_rm_options,
+                            builtin_rm_usage, 0);
        if (!argc)
                usage_with_options(builtin_rm_usage, builtin_rm_options);