Work around missing hard links on FAT formatted media
[gitweb.git] / sha1_file.c
index e45679975e7fcbfae0497f25ab56b6bbd0ff1155..7fdc46969d718096f6492f08489ae20b9693c64b 100644 (file)
@@ -1239,11 +1239,14 @@ int move_temp_to_file(const char *tmpfile, char *filename)
                 * won't be able to check collisions, but that's not a
                 * big deal.
                 *
+                * The same holds for FAT formatted media.
+                *
                 * When this succeeds, we just return 0. We have nothing
                 * left to unlink.
                 */
-               if (ret == EXDEV && !rename(tmpfile, filename))
+               if ((ret == EXDEV || ret == ENOTSUP) && !rename(tmpfile, filename))
                        return 0;
+               ret = errno;
        }
        unlink(tmpfile);
        if (ret) {