Fix git-rev-list "date order" with --topo-order
This fixes git-rev-list so that when there are multiple branches, we still sort the heads in proper approximate date order even when sorting the output topologically. This makes things like gitk --all -d work sanely and show the branches in date order (where "date order" is obviously modified by the paren-child dependency requirements of the topological sort). The trivial fix is to just build the "work" list in date order rather than inserting the new work entries at the beginning. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Linus Torvalds committed
Nov 14, 2005 at 10:01 UTC
2ed02887bda74871bad64f1be36fb4f60d07706e
1 file changed
+3
-2
commit.c
+3
-2
@@ -536,7 +536,7 @@ int count_parents(struct commit * commit)
536
void sort_in_topological_order(struct commit_list ** list)
537
{
538
struct commit_list * next = *list;
539
- struct commit_list * work = NULL;
539
+ struct commit_list * work = NULL, **insert;
540
struct commit_list ** pptr = list;
541
struct sort_node * nodes;
542
struct sort_node * next_nodes;
@@ -580,11 +580,12 @@ void sort_in_topological_order(struct commit_list ** list)
580
* the tips serve as a starting set for the work queue.
581
*/
582
next=*list;
583
+ insert = &work;
584
while (next) {
585
struct sort_node * node = (struct sort_node *)next->item->object.util;
586
587
if (node->indegree == 0) {
587
- commit_list_insert(next->item, &work);
588
+ insert = &commit_list_insert(next->item, insert)->next;
589
}
590
next=next->next;
591
}