hex.c: reduce memory footprint of sha1_to_hex static buffers
[gitweb.git] / unpack-trees.c
index acdd3117370e596716a0bdb751d6255690e6c700..0ddbef3e6355da40a1293a6a7c49b4bc5d75b842 100644 (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));
 }