@@ -39,7 +39,7 @@ impl crate::Repository {
39
39
/// Obtain the best merge-base between commit `one` and `two`, or fail if there is none.
40
40
///
41
41
/// # Performance
42
- /// For repeated calls, prefer [`merge_base_with_cache()`](crate::Repository::merge_base_with_cache ()).
42
+ /// For repeated calls, prefer [`merge_base_with_cache()`](crate::Repository::merge_base_with_graph ()).
43
43
/// Also be sure to [set an object cache](crate::Repository::object_cache_size_if_unset) to accelerate repeated commit lookups.
44
44
#[ cfg( feature = "revision" ) ]
45
45
pub fn merge_base (
@@ -60,47 +60,44 @@ impl crate::Repository {
60
60
}
61
61
62
62
/// Obtain the best merge-base between commit `one` and `two`, or fail if there is none, providing a
63
- /// commit-graph `cache ` to potentially greatly accelerate the operation.
63
+ /// commit-graph `graph ` to potentially greatly accelerate the operation by reusing graphs from previous runs .
64
64
///
65
65
/// # Performance
66
66
/// Be sure to [set an object cache](crate::Repository::object_cache_size_if_unset) to accelerate repeated commit lookups.
67
67
#[ cfg( feature = "revision" ) ]
68
- pub fn merge_base_with_cache (
68
+ pub fn merge_base_with_graph (
69
69
& self ,
70
70
one : impl Into < gix_hash:: ObjectId > ,
71
71
two : impl Into < gix_hash:: ObjectId > ,
72
- cache : Option < & gix_commitgraph :: Graph > ,
73
- ) -> Result < Id < ' _ > , super :: merge_base_with_cache :: Error > {
72
+ graph : & mut gix_revwalk :: Graph < ' _ , ' _ , gix_revwalk :: graph :: Commit < gix_revision :: merge_base :: Flags > > ,
73
+ ) -> Result < Id < ' _ > , super :: merge_base_with_graph :: Error > {
74
74
use crate :: prelude:: ObjectIdExt ;
75
75
let one = one. into ( ) ;
76
76
let two = two. into ( ) ;
77
- let mut graph = self . revision_graph ( cache) ;
78
- let bases = gix_revision:: merge_base ( one, & [ two] , & mut graph) ?. ok_or (
79
- super :: merge_base_with_cache:: Error :: NotFound {
77
+ let bases =
78
+ gix_revision:: merge_base ( one, & [ two] , graph) ?. ok_or ( super :: merge_base_with_graph:: Error :: NotFound {
80
79
first : one,
81
80
second : two,
82
- } ,
83
- ) ?;
81
+ } ) ?;
84
82
Ok ( bases[ 0 ] . attach ( self ) )
85
83
}
86
84
87
85
/// Obtain all merge-bases between commit `one` and `others`, or an empty list if there is none, providing a
88
- /// commit-graph `cache ` to potentially greatly accelerate the operation.
86
+ /// commit-graph `graph ` to potentially greatly accelerate the operation.
89
87
///
90
88
/// # Performance
91
89
/// Be sure to [set an object cache](crate::Repository::object_cache_size_if_unset) to accelerate repeated commit lookups.
92
90
#[ doc( alias = "merge_bases_many" , alias = "git2" ) ]
93
91
#[ cfg( feature = "revision" ) ]
94
- pub fn merge_bases_many_with_cache (
92
+ pub fn merge_bases_many_with_graph (
95
93
& self ,
96
94
one : impl Into < gix_hash:: ObjectId > ,
97
95
others : & [ gix_hash:: ObjectId ] ,
98
- cache : Option < & gix_commitgraph :: Graph > ,
96
+ graph : & mut gix_revwalk :: Graph < ' _ , ' _ , gix_revwalk :: graph :: Commit < gix_revision :: merge_base :: Flags > > ,
99
97
) -> Result < Vec < Id < ' _ > > , gix_revision:: merge_base:: Error > {
100
98
use crate :: prelude:: ObjectIdExt ;
101
99
let one = one. into ( ) ;
102
- let mut graph = self . revision_graph ( cache) ;
103
- Ok ( gix_revision:: merge_base ( one, others, & mut graph) ?
100
+ Ok ( gix_revision:: merge_base ( one, others, graph) ?
104
101
. unwrap_or_default ( )
105
102
. into_iter ( )
106
103
. map ( |id| id. attach ( self ) )
0 commit comments