X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-rm.c;h=b7126e3e25d4f52ae8c4a120d524a24c11129785;hb=1689c5de8730ea334535337a341db3c7a21ad002;hp=50ae6d54011fad89387f0d56ce7a4591d07874f3;hpb=175a494823c1eacd4da9c4a5b90ec0668f7051c0;p=git.git diff --git a/builtin-rm.c b/builtin-rm.c index 50ae6d540..b7126e3e2 100644 --- a/builtin-rm.c +++ b/builtin-rm.c @@ -79,7 +79,8 @@ static int check_local_mod(unsigned char *head, int index_only) || hashcmp(ce->sha1, sha1)) staged_changes = 1; - if (local_changes && staged_changes) + if (local_changes && staged_changes && + !(index_only && is_empty_blob_sha1(ce->sha1))) errs = error("'%s' has staged content different " "from both the file and the HEAD\n" "(use -f to force removal)", name); @@ -137,6 +138,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix) if (read_cache() < 0) die("index file corrupt"); + refresh_cache(REFRESH_QUIET); pathspec = get_pathspec(prefix, argv); seen = NULL;