Merge branch 'js/t5534-rev-parse-gives-multi-line-output-fix'
[gitweb.git] / read-cache.c
index 3c4354ee21c898813e3fdbecf82a5e703e3f1b5e..2121b6e7bba5f310825e0b1f2eccd524cc8658ce 100644 (file)
@@ -2431,6 +2431,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) {