summaryrefslogtreecommitdiff
path: root/builtin-apply.c
diff options
context:
space:
mode:
authorAlex Riesen <raa.lkml@gmail.com>2008-09-27 00:59:14 +0200
committerShawn O. Pearce <spearce@spearce.org>2008-09-29 08:37:07 -0700
commit175a494823c1eacd4da9c4a5b90ec0668f7051c0 (patch)
tree4877e614101afd3512573199e95f9b8b7dbdd0bb /builtin-apply.c
parent4a92d1bfb784b09641180d164e7d719080165dc4 (diff)
downloadgit-175a494823c1eacd4da9c4a5b90ec0668f7051c0.tar.gz
Use remove_path from dir.c instead of own implementation
Besides, it fixes a memleak (builtin-rm.c) and accidental change of the input const argument (builtin-merge-recursive.c). Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'builtin-apply.c')
-rw-r--r--builtin-apply.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/builtin-apply.c b/builtin-apply.c
index 20bef1f21d..70c9f93554 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -13,6 +13,7 @@
#include "delta.h"
#include "builtin.h"
#include "string-list.h"
+#include "dir.h"
/*
* --check turns on checking that the working tree matches the
@@ -2735,15 +2736,7 @@ static void remove_file(struct patch *patch, int rmdir_empty)
warning("unable to remove submodule %s",
patch->old_name);
} else if (!unlink(patch->old_name) && rmdir_empty) {
- char *name = xstrdup(patch->old_name);
- char *end = strrchr(name, '/');
- while (end) {
- *end = 0;
- if (rmdir(name))
- break;
- end = strrchr(name, '/');
- }
- free(name);
+ remove_path(patch->old_name);
}
}
}