X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-apply.c;h=e2c611bf964d8cd589171f74e5ccce5aeb392643;hb=bf8f2ad5f20b8c911d6a84438faa3c994decf71b;hp=2ab4aba5a07727fa6368c6acc9b851830a9c24f3;hpb=6ef1daf77202aee71056771d91dd12121c6061fd;p=git.git diff --git a/builtin-apply.c b/builtin-apply.c index 2ab4aba5a..e2c611bf9 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); } } }