X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=update-cache.c;h=d2f79fa4535d3ec718b60a13a9a8c67d74323d8e;hb=479346adc5ebb099121063d4c06da30093ed9b3b;hp=48b4deeebc92db2bcef97141bb1c162ef4e3dea7;hpb=320d3a1b1aa04d75f0aaff3cc7cf582e144a84c6;p=git.git diff --git a/update-cache.c b/update-cache.c index 48b4deee..d2f79fa4 100644 --- a/update-cache.c +++ b/update-cache.c @@ -13,6 +13,7 @@ * files be revision controlled. */ static int allow_add = 0, allow_remove = 0, allow_replace = 0, not_new = 0; +static int force_remove; /* Three functions to allow overloaded pointer return; see linux/err.h */ static inline void *ERR_PTR(long error) @@ -376,11 +377,7 @@ int main(int argc, char **argv) continue; } if (!strcmp(path, "--force-remove")) { - if (argc <= i + 1) - die("git-update-cache: --force-remove "); - if (remove_file_from_cache(argv[i+1])) - die("git-update-cache: --force-remove cannot remove %s", argv[i+1]); - i++; + force_remove = 1; continue; } @@ -394,6 +391,11 @@ int main(int argc, char **argv) fprintf(stderr, "Ignoring path %s\n", argv[i]); continue; } + if (force_remove) { + if (remove_file_from_cache(path)) + die("git-update-cache: --force-remove cannot remove %s", path); + continue; + } if (add_file_to_cache(path)) die("Unable to add %s to database", path); }