Skip to content

Commit 2175a0c

Browse files
peffgitster
authored andcommitted
fsck: stop checking tag->tagged
Way back in 92d4c85 (fsck-cache: fix SIGSEGV on bad tag object, 2005-05-03), we added an fsck check that the "tagged" field of a tag struct isn't NULL. But that was mainly protecting the printing code for "--tags", and that code wasn't moved along with the check as part of ba002f3 (builtin-fsck: move common object checking code to fsck.c, 2008-02-25). It could also serve to detect type mismatch problems (where a tag points to object X as a commit, but really X is a blob), but it couldn't do so reliably (we'd call lookup_commit(X), but it will only notice the problem if we happen to have previously called lookup_blob(X) in the same process). And as of a commit earlier in this series, we'd consider that a parse error and complain about the object even before getting to this point anyway. So let's drop this "tag->tagged" check. It's not helping anything, and getting rid of it makes the function conceptually cleaner, as it really is just checking the buffer we feed it. In fact, we can get rid of our one-line wrapper and just unify fsck_tag() and fsck_tag_buffer(). Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ec65231 commit 2175a0c

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

fsck.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -798,8 +798,8 @@ static int fsck_commit(struct commit *commit, const char *data,
798798
return ret;
799799
}
800800

801-
static int fsck_tag_buffer(struct tag *tag, const char *data,
802-
unsigned long size, struct fsck_options *options)
801+
static int fsck_tag(struct tag *tag, const char *data,
802+
unsigned long size, struct fsck_options *options)
803803
{
804804
struct object_id oid;
805805
int ret = 0;
@@ -893,17 +893,6 @@ static int fsck_tag_buffer(struct tag *tag, const char *data,
893893
return ret;
894894
}
895895

896-
static int fsck_tag(struct tag *tag, const char *data,
897-
unsigned long size, struct fsck_options *options)
898-
{
899-
struct object *tagged = tag->tagged;
900-
901-
if (!tagged)
902-
return report(options, &tag->object, FSCK_MSG_BAD_TAG_OBJECT, "could not load tagged object");
903-
904-
return fsck_tag_buffer(tag, data, size, options);
905-
}
906-
907896
struct fsck_gitmodules_data {
908897
struct object *obj;
909898
struct fsck_options *options;

0 commit comments

Comments
 (0)