[PATCH 3/4] Work around missing hard links on FAT formatted media

From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Date: 2005-10-26 09:41:20
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>

---

 clone-pack.c |    2 +-
 sha1_file.c  |    5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

applies-to: 73c52ee93ee1d5441a4cb207287b3ba7b0d8f4ed
8ffaffc904086970c66e5e8b7dd54001a1a2c466
diff --git a/clone-pack.c b/clone-pack.c
index 4f4975b..9609219 100644
--- a/clone-pack.c
+++ b/clone-pack.c
@@ -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);
diff --git a/sha1_file.c b/sha1_file.c
index e456799..7fdc469 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1239,11 +1239,14 @@ int move_temp_to_file(const char *tmpfil
 		 * 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) {
---
0.99.8.GIT
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Wed Oct 26 09:41:56 2005

This archive was generated by hypermail 2.1.8 : 2005-10-26 09:42:00 EST