Work around missing hard links on FAT formatted media
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>
Tue, 25 Oct 2005 23:41:20 +0000 (01:41 +0200)
committerJunio C Hamano <junkio@cox.net>
Wed, 26 Oct 2005 06:49:43 +0000 (23:49 -0700)
FAT -- like Coda -- does not like cross-directory hard links. To be
precise, FAT does not like links at all. But links are not needed either.
So get rid of them.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
clone-pack.c
sha1_file.c

index 4f4975b..9609219 100644 (file)
@@ -211,7 +211,7 @@ static int clone_without_unpack(int fd[2])
 
        ifd = fd[0];
        snprintf(tmpfile, sizeof(tmpfile),
-                "%s/pack-XXXXXX", get_object_directory());
+                "%s/pack/tmp-XXXXXX", get_object_directory());
        ofd = mkstemp(tmpfile);
        if (ofd < 0)
                return error("unable to create temporary file %s", tmpfile);
index e456799..7fdc469 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) {