diff --git a/builtin-update-index.c b/builtin-update-index.c
index 09214c8a11e6afb927ab6da1aa3f0be5e50888c8..7f9c638466f79fee7d2914b8ec76d713c3670e7e 100644 (file)
--- a/builtin-update-index.c
+++ b/builtin-update-index.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 (0 <= pos)
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, !info_only))