diff options
Diffstat (limited to 'read-cache.c')
-rw-r--r-- | read-cache.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/read-cache.c b/read-cache.c index d97e3bf7cd..835070e24c 100644 --- a/read-cache.c +++ b/read-cache.c @@ -1800,8 +1800,17 @@ 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 (is_null_sha1(ce->sha1)) { + static const char msg[] = "cache entry has null sha1: %s"; + static int allow = -1; + + if (allow < 0) + allow = git_env_bool("GIT_ALLOW_NULL_SHA1", 0); + if (allow) + warning(msg, ce->name); + else + return error(msg, ce->name); + } if (ce_write_entry(&c, newfd, ce, previous_name) < 0) return -1; } |