summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 418aaf8)
raw | patch | inline | side by side (parent: 418aaf8)
author | Petr Baudis <pasky@ucw.cz> | |
Tue, 31 May 2005 16:52:43 +0000 (18:52 +0200) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Sun, 5 Jun 2005 23:57:23 +0000 (16:57 -0700) |
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>
--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>
Documentation/git-update-cache.txt | patch | blob | history | |
update-cache.c | patch | blob | history |
index 604411d6d79d4178557015bcff52295a18169e60..947f2bded0317bab04598d2fb9755db0995c6c45 100644 (file)
'git-update-cache'
[--add] [--remove] [--refresh] [--replace]
[--ignore-missing]
- [--force-remove <file>]
+ [--force-remove]
[--cacheinfo <mode> <object> <file>]\*
[--] [<file>]\*
--force-remove::
Remove the file from the index even when the working directory
- still has such a file.
+ still has such a file. (Implies --remove.)
--replace::
By default, when a file `path` exists in the index,
diff --git a/update-cache.c b/update-cache.c
index 48b4deeebc92db2bcef97141bb1c162ef4e3dea7..d2f79fa4535d3ec718b60a13a9a8c67d74323d8e 100644 (file)
--- a/update-cache.c
+++ b/update-cache.c
* 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)
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;
}
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);
}