Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
A loose object is not corrupt if it cannot be read due to EMFILE
author
Junio C Hamano
<gitster@pobox.com>
Thu, 28 Oct 2010 18:13:06 +0000
(11:13 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 3 Nov 2010 16:24:57 +0000
(09:24 -0700)
"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>
sha1_file.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
b6c4cec
)
diff --git
a/sha1_file.c
b/sha1_file.c
index 42517987a85df35115c03be0f1fc2ca525448dc9..25f6965294fcc6bc440eda32187e0cc2b67e69d1 100644
(file)
--- 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);
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;
char *path;
const struct packed_git *p;
+ errno = 0;
+ data = read_object(repl, type, size);
if (data) {
if (replacement)
*replacement = repl;
return data;
}
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",
/* die if we replaced an object with one that does not exist */
if (repl != sha1)
die("replacement %s not found for %s",