SubmittingPatches: itemize and reflect upon well written changes
[gitweb.git] / sha1_file.c
index 8fe135dc61908103cf2d7de700794843f83db057..11969fc161bb56af410a76f0791dc9cb3bec0e1b 100644 (file)
@@ -2225,7 +2225,9 @@ int move_temp_to_file(const char *tmpfile, const char *filename)
 {
        int ret = 0;
 
-       if (link(tmpfile, filename))
+       if (unreliable_hardlinks)
+               goto try_rename;
+       else if (link(tmpfile, filename))
                ret = errno;
 
        /*
@@ -2240,6 +2242,7 @@ int move_temp_to_file(const char *tmpfile, const char *filename)
         * left to unlink.
         */
        if (ret && ret != EEXIST) {
+       try_rename:
                if (!rename(tmpfile, filename))
                        goto out;
                ret = errno;