Skip to content

Commit

Permalink
revert clear-commit-marks for now.
Browse files Browse the repository at this point in the history
Earlier change broke "git describe A B" among other things.
Revert it for now, and clean the commits smudged by
get_merge_bases using clear_object_marks() function.  For
complex commit ancestry graph, this is way cheaper as well.

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Jul 3, 2006
1 parent 2ef1080 commit 160b798
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
13 changes: 6 additions & 7 deletions commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,12 +397,13 @@ void clear_commit_marks(struct commit *commit, unsigned int mark)
{
struct commit_list *parents;

if (!commit)
return;
parents = commit->parents;
commit->object.flags &= ~mark;
while (parents) {
clear_commit_marks(parents->item, mark);
struct commit *parent = parents->item;
if (parent && parent->object.parsed &&
(parent->object.flags & mark))
clear_commit_marks(parent, mark);
parents = parents->next;
}
}
Expand Down Expand Up @@ -1082,10 +1083,8 @@ struct commit_list *get_merge_bases(struct commit *rev1, struct commit *rev2,
}

finish:
if (cleanup) {
clear_commit_marks(rev1, PARENT1 | PARENT2 | STALE);
clear_commit_marks(rev2, PARENT1 | PARENT2 | STALE);
}
if (cleanup)
clear_object_marks(PARENT1 | PARENT2 | STALE);

return result;
}
9 changes: 9 additions & 0 deletions object.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,12 @@ void add_object_array(struct object *obj, const char *name, struct object_array
objects[nr].name = name;
array->nr = ++nr;
}

void clear_object_marks(unsigned mark)
{
int i;

for (i = 0; i < obj_allocs; i++)
if (objs[i])
objs[i]->flags &= ~mark;
}
2 changes: 2 additions & 0 deletions object.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,6 @@ int object_list_contains(struct object_list *list, struct object *obj);
/* Object array handling .. */
void add_object_array(struct object *obj, const char *name, struct object_array *array);

void clear_object_marks(unsigned);

#endif /* OBJECT_H */

0 comments on commit 160b798

Please sign in to comment.