Code

Re-fix clear_commit_marks().
authorJunio C Hamano <junkio@cox.net>
Wed, 5 Jul 2006 00:45:22 +0000 (17:45 -0700)
committerJunio C Hamano <junkio@cox.net>
Wed, 5 Jul 2006 00:45:22 +0000 (17:45 -0700)
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>
commit.c
object.c
object.h

index 04390643e8a26d38af32268610ad46d6095f81b7..c6bf10d045a45a38352af0a7dc0b3732b7493182 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -397,12 +397,13 @@ void clear_commit_marks(struct commit *commit, unsigned int mark)
 {
        struct commit_list *parents;
 
-       parents = commit->parents;
        commit->object.flags &= ~mark;
+       parents = commit->parents;
        while (parents) {
                struct commit *parent = parents->item;
-               if (parent && parent->object.parsed &&
-                   (parent->object.flags & mark))
+
+               /* Have we already cleared this? */
+               if (mark & parent->object.flags)
                        clear_commit_marks(parent, mark);
                parents = parents->next;
        }
@@ -1083,8 +1084,10 @@ struct commit_list *get_merge_bases(struct commit *rev1, struct commit *rev2,
        }
 
  finish:
-       if (cleanup)
-               clear_object_marks(PARENT1 | PARENT2 | STALE);
+       if (cleanup) {
+               clear_commit_marks(rev1, PARENT1 | PARENT2 | STALE);
+               clear_commit_marks(rev2, PARENT1 | PARENT2 | STALE);
+       }
 
        return result;
 }
index 1c3675971599c1edfbc5752e2a56dce1a2322e7c..37277f94384fff1320381a370dd4d6c91a4ded2c 100644 (file)
--- a/object.c
+++ b/object.c
@@ -235,12 +235,3 @@ 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_hash_size; i++)
-               if (obj_hash[i])
-                       obj_hash[i]->flags &= ~mark;
-}
index d8a76ea93552e0896d4d0c1dfbf60fa01436e6f5..e0125e154fd970209d30138858f31ef2017651ac 100644 (file)
--- a/object.h
+++ b/object.h
@@ -84,6 +84,4 @@ 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 */