Skip to content

Commit 1c1d037

Browse files
committed
feat: add topo::Builder::with_ends for adding ends after from_iters
Currently, `Builder::from_iters` takes as arguments both the tips and ends, and it's the only possibility for specifying either of them during the building process. Considering that `ends` in `Builder::from_iters` is an `Option`, this is not very builder-like and obstructs some use-cases. This change introduces a fn which allows adding additional ends after initial construction of a "fresh" `Builder`.
1 parent 520c832 commit 1c1d037

File tree

1 file changed

+8
-0
lines changed
  • gix-traverse/src/commit/topo

1 file changed

+8
-0
lines changed

gix-traverse/src/commit/topo/init.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ where
4444
}
4545
}
4646

47+
/// Add commits ending the traversal. These commits themselves will not be
48+
/// read, i.e. the behavior is similar to specifying additional `ends` in
49+
/// `git rev-list --topo-order ^ends tips`.
50+
pub fn with_ends(mut self, ends: impl IntoIterator<Item = impl Into<ObjectId>>) -> Self {
51+
self.ends.extend(ends.into_iter().map(Into::into));
52+
self
53+
}
54+
4755
/// Set a `predicate` to filter out revisions from the walk. Can be used to
4856
/// implement e.g. filtering on paths or time. This does *not* exclude the
4957
/// parent(s) of a revision that is excluded. Specify a revision as an 'end'

0 commit comments

Comments
 (0)