Skip to content

Change walk order from ByCommitTime to topological order - #2991

Open
peso wants to merge 4 commits into
gitui-org:masterfrom
peso:topo-order
Open

Change walk order from ByCommitTime to topological order#2991
peso wants to merge 4 commits into
gitui-org:masterfrom
peso:topo-order

Conversation

@peso

@peso peso commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

This is preparation for a graph implementation.

Currently, commits are sorted by commit time without regard to parent-child relations. This means a parent with a date more recent than its child will appear before its child. git log has options --date-order and --author-date-order both of which show no parents before all its children, before ordering commits by date.

If sorted by commit time, a graph may have to draw a parent before its child. This is confusing to the user and require extra memory for the graph render algorithm. Topology order makes graph visualisation much simpler as all children are now visited before their parents.

This Pull Request prepares a PR for issue #81. It is relevant to both PR #2628 and PR #2890.

It changes the following:

  • Commits was ordered by commit time, but are now in topology order.

I followed the checklist:

  • I added unittests
  • I ran make check without errors
  • I tested the overall application
  • I added an appropriate item to the changelog

@peso
peso marked this pull request as draft July 9, 2026 05:58
peso added 4 commits July 30, 2026 05:57
This is preparation for a log graph implementation.

In case of a diamond graph where the common ancestor has a newer
date than some of its children, the walk order of the current code
will violate topology order.

If commits are not in topology order, a graph may have to draw 
a parent before its child. This is confusing to the user and 
require extra memory for the graph render algorithm.
LogWalker uses git2, due to SharedCommitFilterFn
LogWalkerWithoutFilter is based on gix, so it touches
a different part of the code.
@peso
peso marked this pull request as ready for review July 30, 2026 04:26
@extrawurst
extrawurst requested a review from cruessler July 30, 2026 06:45
@extrawurst

Copy link
Copy Markdown
Collaborator

@cruessler do you recall why we changed this in the first place?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants