pub enum Sorting {
BreadthFirst,
ByCommitTime(CommitTimeOrder),
ByCommitTimeCutoff {
order: CommitTimeOrder,
seconds: SecondsSinceUnixEpoch,
},
}
Expand description
Specify how to sort commits during a simple traversal.
§Sample History
The following history will be referred to for explaining how the sort order works, with the number denoting the commit timestamp (their X-alignment doesn’t matter).
---1----2----4----7 <- second parent of 8
\ \
3----5----6----8---
Variants§
BreadthFirst
Commits are sorted as they are mentioned in the commit graph.
In the sample history the order would be 8, 6, 7, 5, 4, 3, 2, 1
.
§Note
This is not to be confused with git log/rev-list --topo-order
, which is notably different from
as it avoids overlapping branches.
ByCommitTime(CommitTimeOrder)
Commits are sorted by their commit time in the order specified, either newest or oldest first.
The sorting applies to all currently queued commit ids and thus is full.
In the sample history the order would be 8, 7, 6, 5, 4, 3, 2, 1
for NewestFirst
,
or 1, 2, 3, 4, 5, 6, 7, 8
for OldestFirst
.
§Performance
This mode benefits greatly from having an object_cache in find()
to avoid having to lookup each commit twice.
ByCommitTimeCutoff
This sorting is similar to ByCommitTime
, but adds a cutoff to not return commits older than
a given time, stopping the iteration once no younger commits is queued to be traversed.
As the query is usually repeated with different cutoff dates, this search mode benefits greatly from an object cache.
In the sample history and a cut-off date of 4, the returned list of commits would be 8, 7, 6, 4
.
Fields
order: CommitTimeOrder
The order in which to prioritize lookups.
seconds: SecondsSinceUnixEpoch
The amount of seconds since unix epoch, the same value obtained by any gix_date::Time
structure and the way git counts time.