Code

diff -M: release the preimage candidate blobs after rename detection.
[git.git] / builtin-fsck.c
index f480e700e9607068a8d949a520b6760593a522f7..44ce629a498f986f239e008a61d32e10968907e0 100644 (file)
@@ -219,6 +219,7 @@ static int fsck_tree(struct tree *item)
 {
        int retval;
        int has_full_path = 0;
+       int has_empty_name = 0;
        int has_zero_pad = 0;
        int has_bad_modes = 0;
        int has_dup_entries = 0;
@@ -242,6 +243,8 @@ static int fsck_tree(struct tree *item)
 
                if (strchr(name, '/'))
                        has_full_path = 1;
+               if (!*name)
+                       has_empty_name = 1;
                has_zero_pad |= *(char *)desc.buffer == '0';
                update_tree_entry(&desc);
 
@@ -253,6 +256,7 @@ static int fsck_tree(struct tree *item)
                case S_IFREG | 0644:
                case S_IFLNK:
                case S_IFDIR:
+               case S_IFDIRLNK:
                        break;
                /*
                 * This is nonstandard, but we had a few of these
@@ -290,6 +294,9 @@ static int fsck_tree(struct tree *item)
        if (has_full_path) {
                objwarning(&item->object, "contains full pathnames");
        }
+       if (has_empty_name) {
+               objwarning(&item->object, "contains empty pathname");
+       }
        if (has_zero_pad) {
                objwarning(&item->object, "contains zero-padded file modes");
        }
@@ -703,8 +710,14 @@ int cmd_fsck(int argc, char **argv, const char *prefix)
                int i;
                read_cache();
                for (i = 0; i < active_nr; i++) {
-                       struct blob *blob = lookup_blob(active_cache[i]->sha1);
+                       unsigned int mode;
+                       struct blob *blob;
                        struct object *obj;
+
+                       mode = ntohl(active_cache[i]->ce_mode);
+                       if (S_ISDIRLNK(mode))
+                               continue;
+                       blob = lookup_blob(active_cache[i]->sha1);
                        if (!blob)
                                continue;
                        obj = &blob->object;