aboutsummaryrefslogtreecommitdiff
path: root/update-cache.c
diff options
context:
space:
mode:
authorPetr Baudis <pasky@ucw.cz>2005-05-31 18:52:43 +0200
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-05 16:57:23 -0700
commit9b63f50148bd155c00b6893dbbf48583f7b0848d (patch)
treec1b73762bee105ff0a334e598af2a9b52f559bd4 /update-cache.c
parent418aaf847a8b3ffffb4f777a2dd5262ca5ce0ef7 (diff)
downloadgit-9b63f50148bd155c00b6893dbbf48583f7b0848d.tar.gz
git-9b63f50148bd155c00b6893dbbf48583f7b0848d.tar.xz
[PATCH] Make git-update-cache --force-remove regular
Make the --force-remove flag behave same as --add, --remove and --replace. This means I can do git-update-cache --force-remove -- file1.c file2.c which is probably saner and also makes it easier to use in cg-rm. Signed-off-by: Petr Baudis <pasky@ucw.cz> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'update-cache.c')
-rw-r--r--update-cache.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/update-cache.c b/update-cache.c
index 48b4deeeb..d2f79fa45 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 <path>");
- 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);
}