subtree: improve decision on merges kept in split
[gitweb.git] / commit-reach.c
index e748414d04b4f810e4e1c5647c5f53fb072ffb81..00e5ceee6fc8c33dad6071862ee7fe7923f3aa33 100644 (file)
@@ -39,6 +39,9 @@ static struct commit_list *paint_down_to_common(struct commit *one, int n,
        int i;
        uint32_t last_gen = GENERATION_NUMBER_INFINITY;
 
+       if (!min_generation)
+               queue.compare = compare_commits_by_commit_date;
+
        one->object.flags |= PARENT1;
        if (!n) {
                commit_list_append(one, &result);
@@ -56,7 +59,7 @@ static struct commit_list *paint_down_to_common(struct commit *one, int n,
                struct commit_list *parents;
                int flags;
 
-               if (commit->generation > last_gen)
+               if (min_generation && commit->generation > last_gen)
                        BUG("bad generation skip %8x > %8x at %s",
                            commit->generation, last_gen,
                            oid_to_hex(&commit->object.oid));
@@ -626,6 +629,11 @@ int can_all_from_reach_with_flag(struct object_array *from,
                clear_commit_marks(list[i], RESULT);
                clear_commit_marks(list[i], assign_flag);
        }
+       free(list);
+
+       for (i = 0; i < from->nr; i++)
+               from->objects[i].item->flags &= ~assign_flag;
+
        return result;
 }