Skip to content

Commit 25b3d23

Browse files
OsseByron
authored andcommitted
Initial implementation of topological commit walk
This commit introduces a new module `topo` in gix-traverse that contains an iterator for walking commits topologically. It is very much based on the existing Git implementation introduced in b454241[1] as well as improvements done since then. Function names are kept as much as possible. The mailing list[2] has a lot of interesting discussion about how the algorithm works. In short it is a three stage process that aims to reduce the amount of traversal needed before the first result can be output. Hopefully this makes it easier to use gitoxide to implement other tools that need topological sorting, e.g. graphical log and blame. For tests there is a separate type named TraversalAssertion. There is probably grounds for making code more common in this area. [1]: git/git@b454241 [2]: https://public-inbox.org/git/[email protected]/ Add tests for gix_traverse::topo This unfortunately duplicates types found in the existing tests.
1 parent 5b3dfbb commit 25b3d23

File tree

8 files changed

+1038
-0
lines changed

8 files changed

+1038
-0
lines changed

Cargo.lock

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gix-traverse/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,7 @@ gix-date = { version = "^0.8.5", path = "../gix-date" }
2020
gix-hashtable = { version = "^0.5.2", path = "../gix-hashtable" }
2121
gix-revwalk = { version = "^0.13.0", path = "../gix-revwalk" }
2222
gix-commitgraph = { version = "^0.24.2", path = "../gix-commitgraph" }
23+
gix-revision = { version = "^0.27.0", path = "../gix-revision" }
2324
smallvec = "1.10.0"
2425
thiserror = "1.0.32"
26+
bitflags = "2"

gix-traverse/src/commit/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ use smallvec::SmallVec;
55
pub mod ancestors;
66
pub use ancestors::{Ancestors, Sorting};
77

8+
// Topological traversal
9+
pub mod topo;
10+
811
/// Specify how to handle commit parents during traversal.
912
#[derive(Default, Copy, Clone)]
1013
pub enum Parents {

0 commit comments

Comments
 (0)