Thread (1 message) 1 message, 1 author, 2016-06-15

Re: git-rev-list --date-order ?

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:19
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

Paul Mackerras [off-list ref] writes:
Junio,

Gitk has a -d option that tells it to reorder the commits in
decreasing order of their commit time, subject to the constraint that
parents come after all of their children.  Currently it uses
git-rev-list --header --topo-order --parents and then reorders the
commits internally.

How hard would it be to add a --date-order flag to git-rev-list to
make it order the commits in decreasing commit time order, subject to
the constraint that parents come after their children?

If we had that then I could remove another chunk of code from gitk and
make it a bit faster.
It's been a while that I read the topo-order code, but I suspect
something like this?  I may be completely off the mark here.

--
diff --git a/commit.c b/commit.c
index 67e11d7..0d94e4d 100644
--- a/commit.c
+++ b/commit.c
@@ -630,7 +630,9 @@ void sort_in_topological_order(struct co
 		}
 		next=next->next;
 	}
+
 	/* process the list in topological order */
+	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;
@@ -648,7 +650,7 @@ void sort_in_topological_order(struct co
                                  */
 				pn->indegree--;
 				if (!pn->indegree) 
-					commit_list_insert(parent, &work);
+					insert_by_date(parent, &work);
 			}
 			parents=parents->next;
 		}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help