aboutsummaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-06-16 17:17:10 -0700
committerJunio C Hamano <gitster@pobox.com>2008-06-16 21:46:47 -0700
commit1421c5f274a10f93ce5e8b51c0e1351905f84f4e (patch)
tree03119b3cbab0932a2692bf86d6d6cdab69797011 /sha1_file.c
parent328a4750b155df9de29cac007c74e2412d244620 (diff)
downloadgit-1421c5f274a10f93ce5e8b51c0e1351905f84f4e.tar.gz
git-1421c5f274a10f93ce5e8b51c0e1351905f84f4e.tar.xz
write_loose_object: don't bother trying to read an old object
Before even calling this, all callers have done a "has_sha1_file(sha1)" or "has_loose_object(sha1)" check, so there is no point in doing a second check. If something races with us on object creation, we handle that in the final link() that moves it to the right place. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c14
1 files changed, 0 insertions, 14 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 37bcc5474..500584b64 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2145,20 +2145,6 @@ static int write_loose_object(const unsigned char *sha1, char *hdr, int hdrlen,
static char tmpfile[PATH_MAX];
filename = sha1_file_name(sha1);
- fd = open(filename, O_RDONLY);
- if (fd >= 0) {
- /*
- * FIXME!!! We might do collision checking here, but we'd
- * need to uncompress the old file and check it. Later.
- */
- close(fd);
- return 0;
- }
-
- if (errno != ENOENT) {
- return error("sha1 file %s: %s\n", filename, strerror(errno));
- }
-
fd = create_tmpfile(tmpfile, sizeof(tmpfile), filename);
if (fd < 0) {
if (errno == EPERM)