Re-fix clear_commit_marks().
Fix clear_commit_marks() enough to be usable in get_merge_bases(), and retire now unused clear_object_marks(). Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Jul 4, 2006 at 17:45 UTC
58ecf5c1cd9b2f712f85e23f065d3214cd867a71
3 files changed
+8
-16
commit.c
+8
-5
@@ -397,12 +397,13 @@ void clear_commit_marks(struct commit *commit, unsigned int mark)
397
{
398
struct commit_list *parents;
399
400
- parents = commit->parents;
400
commit->object.flags &= ~mark;
401
+ parents = commit->parents;
402
while (parents) {
403
struct commit *parent = parents->item;
404
- if (parent && parent->object.parsed &&
405
- (parent->object.flags & mark))
404
+
405
+ /* Have we already cleared this? */
406
+ if (mark & parent->object.flags)
407
clear_commit_marks(parent, mark);
408
parents = parents->next;
409
}
@@ -1083,8 +1084,10 @@ struct commit_list *get_merge_bases(struct commit *rev1, struct commit *rev2,
1084
}
1085
1086
finish:
1086
- if (cleanup)
1087
- clear_object_marks(PARENT1 | PARENT2 | STALE);
1087
+ if (cleanup) {
1088
+ clear_commit_marks(rev1, PARENT1 | PARENT2 | STALE);
1089
+ clear_commit_marks(rev2, PARENT1 | PARENT2 | STALE);
1090
+ }
1091
1092
return result;
1093
}
object.c
-9
@@ -235,12 +235,3 @@ void add_object_array(struct object *obj, const char *name, struct object_array
235
objects[nr].name = name;
236
array->nr = ++nr;
237
}
238
-
239
-void clear_object_marks(unsigned mark)
240
-{
241
- int i;
242
-
243
- for (i = 0; i < obj_hash_size; i++)
244
- if (obj_hash[i])
245
- obj_hash[i]->flags &= ~mark;
246
-}
object.h
-2
@@ -84,6 +84,4 @@ int object_list_contains(struct object_list *list, struct object *obj);
84
/* Object array handling .. */
85
void add_object_array(struct object *obj, const char *name, struct object_array *array);
86
87
-void clear_object_marks(unsigned);
88
-
87
#endif /* OBJECT_H */