Merge branch 'jc/test-prereq' into maint
[gitweb.git] / read-cache.c
index 2f8159fb165f853aafb5e0cee61f35aa854271ec..d2be78ea95e2e554b085721bafa939c9024125ed 100644 (file)
@@ -1800,6 +1800,8 @@ int write_index(struct index_state *istate, int newfd)
                        continue;
                if (!ce_uptodate(ce) && is_racy_timestamp(istate, ce))
                        ce_smudge_racily_clean_entry(ce);
+               if (is_null_sha1(ce->sha1))
+                       return error("cache entry has null sha1: %s", ce->name);
                if (ce_write_entry(&c, newfd, ce, previous_name) < 0)
                        return -1;
        }