Merge branch 'pc/remove-warn'

* pc/remove-warn:
  Remove a redundant errno test in a usage of remove_path
  Introduce remove_or_warn function
  Implement the rmdir_or_warn function
  Generalise the unlink_or_warn function
This commit is contained in:
Junio C Hamano
2010-05-08 22:32:59 -07:00
6 changed files with 68 additions and 21 deletions

View File

@ -3141,11 +3141,7 @@ static void remove_file(struct patch *patch, int rmdir_empty)
die("unable to remove %s from index", patch->old_name);
}
if (!cached) {
if (S_ISGITLINK(patch->old_mode)) {
if (rmdir(patch->old_name))
warning("unable to remove submodule %s",
patch->old_name);
} else if (!unlink_or_warn(patch->old_name) && rmdir_empty) {
if (!remove_or_warn(patch->old_mode, patch->old_name) && rmdir_empty) {
remove_path(patch->old_name);
}
}