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 <raa.lkml@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
Alex Riesen 2008-09-25 22:12:45 +02:00 committed by Shawn O. Pearce
parent fee75457fc
commit 41f13af558
2 changed files with 12 additions and 3 deletions

View file

@ -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;
}

View file

@ -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