summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d93b7d1)
raw | patch | inline | side by side (parent: d93b7d1)
author | Alexandre Julliard <julliard@winehq.org> | |
Tue, 9 Jan 2007 20:25:46 +0000 (21:25 +0100) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 10 Jan 2007 00:05:00 +0000 (16:05 -0800) |
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-apply.c | patch | blob | history |
diff --git a/builtin-apply.c b/builtin-apply.c
index 38a9fdd80867e4548777887e6f6878b8f408eaa5..54fd2cb0c71dc97a47d0286d7b201545a7308b01 100644 (file)
--- a/builtin-apply.c
+++ b/builtin-apply.c
die("unable to remove %s from index", patch->old_name);
cache_tree_invalidate_path(active_cache_tree, patch->old_name);
}
- if (!cached)
- unlink(patch->old_name);
+ if (!cached) {
+ if (!unlink(patch->old_name)) {
+ char *name = xstrdup(patch->old_name);
+ char *end = strrchr(name, '/');
+ while (end) {
+ *end = 0;
+ if (rmdir(name))
+ break;
+ end = strrchr(name, '/');
+ }
+ free(name);
+ }
+ }
}
static void add_index_file(const char *path, unsigned mode, void *buf, unsigned long size)