Skip to content

Commit

Permalink
Teach fsck-cache to accept non-commits for reachability analysis.
Browse files Browse the repository at this point in the history
In particular, teach it about tags. Also, to make reachability actually
work for tags, we need to add the ref to the tagged object.
  • Loading branch information
Linus Torvalds committed May 5, 2005
1 parent 552e2bd commit 770896e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 3 additions & 5 deletions fsck-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,14 +295,12 @@ int main(int argc, char **argv)
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++;
Expand Down
2 changes: 2 additions & 0 deletions tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ int parse_tag(struct tag *item)
goto err;

item->tagged = parse_object(object);
if (item->tagged)
add_ref(&item->object, item->tagged);

type_line = data + 48;
if (memcmp("\ntype ", type_line-1, 6))
Expand Down

0 comments on commit 770896e

Please sign in to comment.