Since --merge-order is the only thing that cares about the rev-list parse order, change the rev-list list to match the parse order and remove the corresponding compensating reversal from epoch.c.
Signed-off-by: Jon Seymour <[EMAIL PROTECTED]> --- [PATCH] Move SEEN flag into epoch.h, replace use of VISITED flag with SEEN flag --- epoch.c | 26 ++++++++++++-------------- rev-list.c | 3 ++- 2 files changed, 14 insertions(+), 15 deletions(-) 198b131890a2c6fc98ce4c151dc20bd4f548acf0 diff --git a/epoch.c b/epoch.c --- a/epoch.c +++ b/epoch.c @@ -580,37 +580,35 @@ int sort_list_in_merge_order(struct comm struct commit *base; int ret = 0; int action = CONTINUE; - struct commit_list *reversed = NULL; + struct commit_list *next = NULL; - for (; list; list = list->next) { - list->item->object.flags &= ~(SEEN|BOUNDARY|DISCONTINUITY); - commit_list_insert(list->item, &reversed); - } + for (next=list; next; next = next->next) + next->item->object.flags &= ~(SEEN|BOUNDARY|DISCONTINUITY); - if (!reversed) + if (!list) return ret; - else if (!reversed->next) { + else if (!list->next) { /* * If there is only one element in the list, we can sort it * using sort_in_merge_order. */ - base = reversed->item; + base = list->item; } else { /* * Otherwise, we search for the base of the list. */ - ret = find_base_for_list(reversed, &base); + ret = find_base_for_list(list, &base); if (ret) return ret; if (base) base->object.flags |= BOUNDARY; - while (reversed) { - struct commit * next = pop_commit(&reversed); + for (next=list; next; next=next->next) { + struct commit * next_item = next->item; - if (!(next->object.flags & SEEN) && next!=base) { - sort_first_epoch(next, &stack); - if (reversed) { + if (!(next_item->object.flags & SEEN) && next_item!=base) { + sort_first_epoch(next_item, &stack); + if (next) { /* * If we have more commits * to push, then the first diff --git a/rev-list.c b/rev-list.c --- a/rev-list.c +++ b/rev-list.c @@ -407,6 +407,7 @@ static struct commit *get_commit_referen int main(int argc, char **argv) { struct commit_list *list = NULL; + struct commit_list **list_tail = &list; int i, limited = 0; for (i = 1 ; i < argc; i++) { @@ -484,7 +485,7 @@ int main(int argc, char **argv) if (commit->object.flags & SEEN) continue; commit->object.flags |= SEEN; - commit_list_insert(commit, &list); + list_tail = &commit_list_insert(commit, list_tail)->next; } if (!merge_order) { ------------ - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html