summaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2006-02-18 01:24:10 -0800
committerLibravatar Junio C Hamano <junkio@cox.net>2006-02-18 01:24:10 -0800
commit62a4417b574ce5120882016fd7803b9bccf68a67 (patch)
tree62f18b3790e16f0be4d822822a48aa808d7f41b8 /commit.c
parentMerge branch 'jc/rebase-limit' (diff)
parenttopo-order: make --date-order optional. (diff)
downloadtgif-62a4417b574ce5120882016fd7803b9bccf68a67.tar.xz
Merge branch 'jc/topo'
* jc/topo: topo-order: make --date-order optional.
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/commit.c b/commit.c
index 67e11d7a4f..c550a00d82 100644
--- a/commit.c
+++ b/commit.c
@@ -571,7 +571,7 @@ int count_parents(struct commit * commit)
/*
* Performs an in-place topological sort on the list supplied.
*/
-void sort_in_topological_order(struct commit_list ** list)
+void sort_in_topological_order(struct commit_list ** list, int lifo)
{
struct commit_list * next = *list;
struct commit_list * work = NULL, **insert;
@@ -630,7 +630,10 @@ void sort_in_topological_order(struct commit_list ** list)
}
next=next->next;
}
+
/* process the list in topological order */
+ if (!lifo)
+ sort_by_date(&work);
while (work) {
struct commit * work_item = pop_commit(&work);
struct sort_node * work_node = (struct sort_node *)work_item->object.util;
@@ -647,8 +650,12 @@ void sort_in_topological_order(struct commit_list ** list)
* guaranteeing topological order.
*/
pn->indegree--;
- if (!pn->indegree)
- commit_list_insert(parent, &work);
+ if (!pn->indegree) {
+ if (!lifo)
+ insert_by_date(parent, &work);
+ else
+ commit_list_insert(parent, &work);
+ }
}
parents=parents->next;
}