Merge branch 'pc/uninteresting-submodule-disappear-upon-switch-branches'

* pc/uninteresting-submodule-disappear-upon-switch-branches:
  Remove empty directories when checking out a commit with fewer submodules
This commit is contained in:
Junio C Hamano
2010-01-18 18:12:57 -08:00
2 changed files with 19 additions and 2 deletions

View File

@ -67,8 +67,16 @@ static void unlink_entry(struct cache_entry *ce)
{
if (has_symlink_or_noent_leading_path(ce->name, ce_namelen(ce)))
return;
if (unlink_or_warn(ce->name))
return;
if (S_ISGITLINK(ce->ce_mode)) {
if (rmdir(ce->name)) {
warning("unable to rmdir %s: %s",
ce->name, strerror(errno));
return;
}
}
else
if (unlink_or_warn(ce->name))
return;
schedule_dir_for_removal(ce->name, ce_namelen(ce));
}