From: Alex Riesen Date: Thu, 25 Sep 2008 20:12:45 +0000 (+0200) Subject: Remove empty directories in recursive merge X-Git-Tag: v1.6.0.3~60 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=41f13af558db1018250ade4d99a51f0b76f65bc8;p=git.git Remove empty directories in recursive merge The code was actually supposed to do that, but was accidentally broken. Noticed by Anders Melchiorsen. Signed-off-by: Alex Riesen Signed-off-by: Shawn O. Pearce --- diff --git a/builtin-merge-recursive.c b/builtin-merge-recursive.c index 43e55bf90..f628a6275 100644 --- a/builtin-merge-recursive.c +++ b/builtin-merge-recursive.c @@ -444,10 +444,8 @@ static int remove_file(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; } diff --git a/t/t3030-merge-recursive.sh b/t/t3030-merge-recursive.sh index de0cdb1cf..0de613dc5 100755 --- a/t/t3030-merge-recursive.sh +++ b/t/t3030-merge-recursive.sh @@ -535,4 +535,15 @@ test_expect_success 'reset and bind merge' ' ' +test_expect_success 'merge removes empty directories' ' + + git reset --hard master && + git checkout -b rm && + git rm d/e && + git commit -mremoved-d/e && + git checkout master && + git merge -s recursive rm && + test_must_fail test -d d +' + test_done