summaryrefslogtreecommitdiff
path: root/builtin/apply.c
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2010-03-26 15:25:34 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-03-28 16:53:04 (GMT)
commit80d706afed6c6c6fb3ac9c168a6a958244405b45 (patch)
tree18687c3c32ff6cd9a56ec42d1e46413d1ac8ed35 /builtin/apply.c
parentd1723296af67e6bbadf6e73cd1e921aefafe491f (diff)
downloadgit-80d706afed6c6c6fb3ac9c168a6a958244405b45.zip
git-80d706afed6c6c6fb3ac9c168a6a958244405b45.tar.gz
git-80d706afed6c6c6fb3ac9c168a6a958244405b45.tar.bz2
Introduce remove_or_warn function
This patch introduces the remove_or_warn function which is a generalised version of the {unlink,rmdir}_or_warn functions. It takes an additional parameter indicating the mode of the file to be removed. The patch also modifies certain functions to use remove_or_warn where appropriate, and adds a test case for a bug fixed by the use of remove_or_warn. Signed-off-by: Peter Collingbourne <peter@pcc.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/apply.c')
-rw-r--r--builtin/apply.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/builtin/apply.c b/builtin/apply.c
index 7ca9047..65a594c 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -3144,11 +3144,7 @@ static void remove_file(struct patch *patch, int rmdir_empty)
die("unable to remove %s from index", patch->old_name);
}
if (!cached) {
- if (S_ISGITLINK(patch->old_mode)) {
- if (rmdir(patch->old_name))
- warning("unable to remove submodule %s",
- patch->old_name);
- } else if (!unlink_or_warn(patch->old_name) && rmdir_empty) {
+ if (!remove_or_warn(patch->old_mode, patch->old_name) && rmdir_empty) {
remove_path(patch->old_name);
}
}