@matheusbsbs / matheus-bagliano / commits / 160b798303
Fork 0

revert clear-commit-marks for now.

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>

Junio C Hamano committed Jul 3, 2006 at 03:05 UTC 160b7983034cdd24ea1bf6ef7a2532a2296461c6
3 files changed +17 -7
commit.c
+6 -7
@@ -397,12 +397,13 @@ void clear_commit_marks(struct commit *commit, unsigned int mark)
397 {
398 struct commit_list *parents;
399
400 - if (!commit)
401 - return;
400 parents = commit->parents;
401 commit->object.flags &= ~mark;
402 while (parents) {
405 - clear_commit_marks(parents->item, mark);
403 + struct commit *parent = parents->item;
404 + if (parent && parent->object.parsed &&
405 + (parent->object.flags & mark))
406 + clear_commit_marks(parent, mark);
407 parents = parents->next;
408 }
409 }
@@ -1082,10 +1083,8 @@ struct commit_list *get_merge_bases(struct commit *rev1, struct commit *rev2,
1083 }
1084
1085 finish:
1085 - if (cleanup) {
1086 - clear_commit_marks(rev1, PARENT1 | PARENT2 | STALE);
1087 - clear_commit_marks(rev2, PARENT1 | PARENT2 | STALE);
1088 - }
1086 + if (cleanup)
1087 + clear_object_marks(PARENT1 | PARENT2 | STALE);
1088
1089 return result;
1090 }
object.c
+9
@@ -217,3 +217,12 @@ void add_object_array(struct object *obj, const char *name, struct object_array
217 objects[nr].name = name;
218 array->nr = ++nr;
219 }
220 +
221 +void clear_object_marks(unsigned mark)
222 +{
223 + int i;
224 +
225 + for (i = 0; i < obj_allocs; i++)
226 + if (objs[i])
227 + objs[i]->flags &= ~mark;
228 +}
object.h
+2
@@ -83,4 +83,6 @@ int object_list_contains(struct object_list *list, struct object *obj);
83 /* Object array handling .. */
84 void add_object_array(struct object *obj, const char *name, struct object_array *array);
85
86 +void clear_object_marks(unsigned);
87 +
88 #endif /* OBJECT_H */