summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3b97fee)
raw | patch | inline | side by side (parent: 3b97fee)
author | Junio C Hamano <junkio@cox.net> | |
Thu, 11 Jan 2007 22:58:47 +0000 (14:58 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 11 Jan 2007 22:58:47 +0000 (14:58 -0800) |
Often the user would do "/bin/rm foo" before telling git, but
then want to tell git about it. "git rm foo" however would fail
because it cannot unlink(2) foo.
Treat ENOENT error return from unlink(2) as if a successful
removal happened.
Signed-off-by: Junio C Hamano <junkio@cox.net>
then want to tell git about it. "git rm foo" however would fail
because it cannot unlink(2) foo.
Treat ENOENT error return from unlink(2) as if a successful
removal happened.
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-rm.c | patch | blob | history |
diff --git a/builtin-rm.c b/builtin-rm.c
index 5b078c41943c9ce0ff1983896e8ad6ae38705f60..d81f289c3c28fa9afbc99facf6ea81b68306a46d 100644 (file)
--- a/builtin-rm.c
+++ b/builtin-rm.c
char *slash;
ret = unlink(name);
+ if (ret && errno == ENOENT)
+ /* The user has removed it from the filesystem by hand */
+ ret = errno = 0;
+
if (!ret && (slash = strrchr(name, '/'))) {
char *n = xstrdup(name);
do {
return 0;
/*
- * Then, unless we used "--cache", remove the filenames from
+ * Then, unless we used "--cached", remove the filenames from
* the workspace. If we fail to remove the first one, we
* abort the "git rm" (but once we've successfully removed
* any file at all, we'll go ahead and commit to it all: