git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <junkio@cox.net>
Date
Feb 16, 2006, 03:11 UTC
Message-ID
<7vpsloknfq.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<17395.58926.26670.23572@cargo.ozlabs.ibm.com>
Paul Mackerras <paulus@samba.org> writes:
Show 14 quoted lines
> 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;
 		}
Previous: Paul MackerrasNext: Junio C Hamano
Message 2 of 3 in “git-rev-list --date-order ?”
  1. Paul MackerrasFeb 16, 2006
  2. Junio C HamanoFeb 16, 2006
  3. topo-order: make --date-order optional.Junio C Hamano, Feb 16, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.