From: Junio C Hamano Date: Thu, 16 Feb 2006 03:11:21 GMT Subject: Re: git-rev-list --date-order ? Message-ID: <7vpsloknfq.fsf@assigned-by-dhcp.cox.net> In-Reply-To: <17395.58926.26670.23572@cargo.ozlabs.ibm.com> Paul Mackerras 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; }