summaryrefslogtreecommitdiff
path: root/fsck-cache.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-24 14:10:55 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-24 14:10:55 -0700
commit4728b861ace127dc39c648f3bea64c3b86bbabc5 (patch)
tree242227fc3c3a74d070ed36496e790335dd00c44a /fsck-cache.c
parentda6abf5d9c342a74dffbcc2015b9c27d7819a900 (diff)
downloadgit-4728b861ace127dc39c648f3bea64c3b86bbabc5.tar.gz
fsck-cache: notice missing "blob" objects.
We should _not_ mark a blob object "parsed" just because we looked it up: it gets marked that way only once we've actually seen it. Otherwise we can never notice a missing blob.
Diffstat (limited to 'fsck-cache.c')
-rw-r--r--fsck-cache.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fsck-cache.c b/fsck-cache.c
index 96b8eb1611..985adb68bb 100644
--- a/fsck-cache.c
+++ b/fsck-cache.c
@@ -60,11 +60,19 @@ static int fsck_commit(unsigned char *sha1, void *data, unsigned long size)
return 0;
}
+static int fsck_blob(unsigned char *sha1, void *data, unsigned long size)
+{
+ struct blob *blob = lookup_blob(sha1);
+ blob->object.parsed = 1;
+ return 0;
+}
+
static int fsck_entry(unsigned char *sha1, char *tag, void *data,
unsigned long size)
{
if (!strcmp(tag, "blob")) {
- lookup_blob(sha1); /* Nothing to check; but notice it. */
+ if (fsck_blob(sha1, data, size) < 0)
+ return -1;
} else if (!strcmp(tag, "tree")) {
if (fsck_tree(sha1, data, size) < 0)
return -1;