28
28
tips : impl IntoIterator < Item = impl Into < ObjectId > > ,
29
29
ends : Option < impl IntoIterator < Item = impl Into < ObjectId > > > ,
30
30
) -> Self {
31
- let mut builder = Self :: new ( find) . with_tips ( tips) ;
32
- if let Some ( ends) = ends {
33
- builder = builder. with_ends ( ends) ;
34
- } ;
35
- builder
31
+ Self :: new ( find) . with_tips ( tips) . with_ends ( ends. into_iter ( ) . flatten ( ) )
36
32
}
37
33
38
34
/// Create a new `Builder` for a [`Topo`] that reads commits from a
@@ -49,16 +45,18 @@ where
49
45
}
50
46
}
51
47
52
- /// Add commits to start reading from. The behavior is similar to specifying
53
- /// additional `ends` in `git rev-list --topo-order ^ends tips`.
48
+ /// Add commits to start reading from.
49
+ ///
50
+ /// The behavior is similar to specifying additional `ends` in `git rev-list --topo-order ^ends tips`.
54
51
pub fn with_tips ( mut self , tips : impl IntoIterator < Item = impl Into < ObjectId > > ) -> Self {
55
52
self . tips . extend ( tips. into_iter ( ) . map ( Into :: into) ) ;
56
53
self
57
54
}
58
55
59
- /// Add commits ending the traversal. These commits themselves will not be
60
- /// read, i.e. the behavior is similar to specifying additional `ends` in
61
- /// `git rev-list --topo-order ^ends tips`.
56
+ /// Add commits ending the traversal.
57
+ ///
58
+ /// These commits themselves will not be read, i.e. the behavior is similar to specifying additional
59
+ /// `ends` in `git rev-list --topo-order ^ends tips`.
62
60
pub fn with_ends ( mut self , ends : impl IntoIterator < Item = impl Into < ObjectId > > ) -> Self {
63
61
self . ends . extend ( ends. into_iter ( ) . map ( Into :: into) ) ;
64
62
self
0 commit comments