"core.sharedrepository = 0mode" should set, not loosen
[gitweb.git] / sha1_file.c
index a07aa4e5c491d16f65bc109673e806e24efb2274..45987bdea8aadba897338e106b208b7c09558065 100644 (file)
@@ -2243,11 +2243,15 @@ static void write_sha1_file_prepare(const void *buf, unsigned long len,
 }
 
 /*
- * Move the just written object into its final resting place
+ * Move the just written object into its final resting place.
+ * NEEDSWORK: this should be renamed to finalize_temp_file() as
+ * "moving" is only a part of what it does, when no patch between
+ * master to pu changes the call sites of this function.
  */
 int move_temp_to_file(const char *tmpfile, const char *filename)
 {
        int ret = 0;
+
        if (link(tmpfile, filename))
                ret = errno;
 
@@ -2275,6 +2279,8 @@ int move_temp_to_file(const char *tmpfile, const char *filename)
                /* FIXME!!! Collision check here ? */
        }
 
+       if (adjust_shared_perm(filename))
+               return error("unable to set permission to '%s'", filename);
        return 0;
 }