summaryrefslogtreecommitdiff
path: root/builtin-merge-recursive.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-merge-recursive.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-merge-recursive.c')
-rw-r--r--builtin-merge-recursive.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/builtin-merge-recursive.c b/builtin-merge-recursive.c
index f628a62751..b9738655ad 100644
--- a/builtin-merge-recursive.c
+++ b/builtin-merge-recursive.c
@@ -18,6 +18,7 @@
#include "ll-merge.h"
#include "interpolate.h"
#include "attr.h"
+#include "dir.h"
#include "merge-recursive.h"
static int subtree_merge;
@@ -416,24 +417,6 @@ static int update_stages(const char *path, struct diff_filespec *o,
return 0;
}
-static int remove_path(const char *name)
-{
- int ret;
- char *slash, *dirs;
-
- ret = unlink(name);
- if (ret)
- return ret;
- dirs = xstrdup(name);
- while ((slash = strrchr(name, '/'))) {
- *slash = '\0';
- if (rmdir(name) != 0)
- break;
- }
- free(dirs);
- return ret;
-}
-
static int remove_file(int clean, const char *path, int no_wd)
{
int update_cache = index_only || clean;
@@ -444,7 +427,7 @@ static int remove_file(int clean, const char *path, int no_wd)
return -1;
}
if (update_working_directory) {
- if (remove_path(path) && errno != ENOENT)
+ if (remove_path(path))
return -1;
}
return 0;