提交 d234b21c 编写于 作者: A Alexandre Julliard 提交者: Junio C Hamano

git-apply: Remove directories that have become empty after deleting a file.

Signed-off-by: NAlexandre Julliard <julliard@winehq.org>
Signed-off-by: NJunio C Hamano <junkio@cox.net>
上级 d93b7d1c
......@@ -2239,8 +2239,19 @@ static void remove_file(struct patch *patch)
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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册