diff --git a/read-cache.c b/read-cache.c index f12da0dbb8..6238df448f 100644 --- a/read-cache.c +++ b/read-cache.c @@ -2428,6 +2428,14 @@ static int write_shared_index(struct index_state *istate, delete_tempfile(&temporary_sharedindex); return ret; } + ret = adjust_shared_perm(get_tempfile_path(&temporary_sharedindex)); + if (ret) { + int save_errno = errno; + error("cannot fix permission bits on %s", get_tempfile_path(&temporary_sharedindex)); + delete_tempfile(&temporary_sharedindex); + errno = save_errno; + return ret; + } ret = rename_tempfile(&temporary_sharedindex, git_path("sharedindex.%s", sha1_to_hex(si->base->sha1))); if (!ret) {