static int fsck_tag(struct tag *tag)
{
+ struct object *tagged = tag->tagged;
+
+ if (!tagged) {
+ printf("bad object in tag %s\n", sha1_to_hex(tag->object.sha1));
+ return -1;
+ }
if (!show_tags)
return 0;
- printf("tagged %s %s",
- tag->tagged->type,
- sha1_to_hex(tag->tagged->sha1));
- printf(" (%s) in %s\n",
- tag->tag, sha1_to_hex(tag->object.sha1));
+ printf("tagged %s %s", tagged->type, sha1_to_hex(tagged->sha1));
+ printf(" (%s) in %s\n", tag->tag, sha1_to_hex(tag->object.sha1));
return 0;
}
continue;
if (!get_sha1(arg, head_sha1)) {
- struct commit *commit = lookup_commit(head_sha1);
- struct object *obj;
+ struct object *obj = lookup_object(head_sha1);
- /* Error is printed by lookup_commit(). */
- if (!commit)
+ /* Error is printed by lookup_object(). */
+ if (!obj)
continue;
- obj = &commit->object;
obj->used = 1;
mark_reachable(obj, REACHABLE);
heads++;