diff --git a/read-cache.c b/read-cache.c
index 20c9d494ac94380c9074997e9cb3c69ff1c04a3f..0f5fb5bc3350f7def1eb14e792507098118d1e66 100644 (file)
--- a/read-cache.c
+++ b/read-cache.c
ce->ce_mode = create_ce_mode(st.st_mode);
if (!trust_executable_bit) {
/* If there is an existing entry, pick the mode bits
- * from it.
+ * from it, otherwise force to 644.
*/
int pos = cache_name_pos(path, namelen);
if (pos >= 0)
ce->ce_mode = active_cache[pos]->ce_mode;
+ else
+ ce->ce_mode = create_ce_mode(S_IFREG | 0644);
}
if (index_path(ce->sha1, path, &st, 1))
die("index file corrupt");
}
-int discard_cache()
+int discard_cache(void)
{
int ret;