#include "interpolate.h"
#include "attr.h"
#include "merge-recursive.h"
+#include "dir.h"
static struct tree *shift_tree_object(struct tree *one, struct tree *two)
{
return 0;
}
-static int remove_path(const char *name)
-{
- char *slash, *dirs;
-
- if (unlink(name))
- return -1;
- dirs = xstrdup(name);
- while ((slash = strrchr(name, '/'))) {
- *slash = '\0';
- if (rmdir(name) != 0)
- break;
- }
- free(dirs);
- return 0;
-}
-
static int remove_file(struct merge_options *o, int clean,
const char *path, int no_wd)
{
return -1;
}
if (update_working_directory) {
- unlink(path);
- if (errno != ENOENT || errno != EISDIR)
+ if (remove_path(path) && errno != ENOENT)
return -1;
- remove_path(path);
}
return 0;
}