Skip to content

Commit

Permalink
fsck-cache: notice missing "blob" objects.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Linus Torvalds committed Apr 24, 2005
1 parent da6abf5 commit 4728b86
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 0 additions & 1 deletion blob.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ struct blob *lookup_blob(unsigned char *sha1)
memset(ret, 0, sizeof(struct blob));
created_object(sha1, &ret->object);
ret->object.type = blob_type;
ret->object.parsed = 1;
return ret;
}
if (obj->parsed && obj->type != blob_type) {
Expand Down
10 changes: 9 additions & 1 deletion fsck-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4728b86

Please sign in to comment.