Re: [PATCH 3/6] git-fsck: Do thorough verification of tag objects.
- From
- Matthias Lederhofer <matled@gmx.net>
- Date
- Jun 4, 2007, 05:56 UTC
- Message-ID
- <20070604055655.GB15148@moooo.ath.cx>
- In-Reply-To
- <200706040253.51920.johan@herland.net>
Johan Herland <johan@herland.net> wrote:
Show 25 quoted lines
> diff --git a/builtin-fsck.c b/builtin-fsck.c
> index cbbcaf0..a8914ae 100644
> --- a/builtin-fsck.c
> +++ b/builtin-fsck.c
> @@ -344,6 +344,20 @@ static int fsck_commit(struct commit *commit)
> static int fsck_tag(struct tag *tag)
> {
> struct object *tagged = tag->tagged;
> + enum object_type type;
> + unsigned long size;
> + char *data = (char *) read_sha1_file(tag->object.sha1, &type, &size);
> + if (!data)
> + return error("Could not read tag %s", sha1_to_hex(tag->object.sha1));
> + if (type != OBJ_TAG) {
> + free(data);
> + return error("Internal error: Tag %s not a tag", sha1_to_hex(tag->object.sha1));
> + }
> + if (parse_and_verify_tag_buffer(0, data, size, 1)) { /* Thoroughly verify tag object */
> + free(data);
> + return error("Tag %s failed thorough tag object verification", sha1_to_hex(tag->object.sha1));
> + }
> + free(data);
>
> if (!tagged) {
> return objerror(&tag->object, "could not load tagged object");The objerror() function prints the sha1 and object type, I think this one should be used instead of error() here.