mirror of
https://github.com/git/git
synced 2024-08-25 10:45:59 +00:00
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>
This commit is contained in:
parent
d4072c9722
commit
2ed02887bd
5
commit.c
5
commit.c
|
@ -536,7 +536,7 @@ int count_parents(struct commit * commit)
|
||||||
void sort_in_topological_order(struct commit_list ** list)
|
void sort_in_topological_order(struct commit_list ** list)
|
||||||
{
|
{
|
||||||
struct commit_list * next = *list;
|
struct commit_list * next = *list;
|
||||||
struct commit_list * work = NULL;
|
struct commit_list * work = NULL, **insert;
|
||||||
struct commit_list ** pptr = list;
|
struct commit_list ** pptr = list;
|
||||||
struct sort_node * nodes;
|
struct sort_node * nodes;
|
||||||
struct sort_node * next_nodes;
|
struct sort_node * next_nodes;
|
||||||
|
@ -580,11 +580,12 @@ void sort_in_topological_order(struct commit_list ** list)
|
||||||
* the tips serve as a starting set for the work queue.
|
* the tips serve as a starting set for the work queue.
|
||||||
*/
|
*/
|
||||||
next=*list;
|
next=*list;
|
||||||
|
insert = &work;
|
||||||
while (next) {
|
while (next) {
|
||||||
struct sort_node * node = (struct sort_node *)next->item->object.util;
|
struct sort_node * node = (struct sort_node *)next->item->object.util;
|
||||||
|
|
||||||
if (node->indegree == 0) {
|
if (node->indegree == 0) {
|
||||||
commit_list_insert(next->item, &work);
|
insert = &commit_list_insert(next->item, insert)->next;
|
||||||
}
|
}
|
||||||
next=next->next;
|
next=next->next;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue