summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-10-28 18:13:06 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-11-03 16:24:57 (GMT)
commit3ba7a065527a27f45659398e882feaa1165cbb4c (patch)
treebc4ca96b86d9bae83cd255983f89bde607ecbb79 /sha1_file.c
parentb6c4ceccb3d6026c612fa55865c51374b26eb176 (diff)
downloadgit-3ba7a065527a27f45659398e882feaa1165cbb4c.zip
git-3ba7a065527a27f45659398e882feaa1165cbb4c.tar.gz
git-3ba7a065527a27f45659398e882feaa1165cbb4c.tar.bz2
A loose object is not corrupt if it cannot be read due to EMFILE
"git fsck" bails out with a claim that a loose object that cannot be read but exists on the filesystem to be corrupt, which is wrong when read_object() failed due to e.g. EMFILE. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 4251798..25f6965 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2090,16 +2090,21 @@ void *read_sha1_file_repl(const unsigned char *sha1,
const unsigned char **replacement)
{
const unsigned char *repl = lookup_replace_object(sha1);
- void *data = read_object(repl, type, size);
+ void *data;
char *path;
const struct packed_git *p;
+ errno = 0;
+ data = read_object(repl, type, size);
if (data) {
if (replacement)
*replacement = repl;
return data;
}
+ if (errno != ENOENT)
+ die_errno("failed to read object %s", sha1_to_hex(sha1));
+
/* die if we replaced an object with one that does not exist */
if (repl != sha1)
die("replacement %s not found for %s",