@@ -3,6 +3,19 @@ use gix_ref::bstr::BStr;
33
44use crate :: { repository:: blame_file, Repository } ;
55
6+ /// Options to be passed to [Repository::blame_file()](crate::Repository::blame_file()).
7+ #[ derive( Default , Debug , Clone ) ]
8+ pub struct Options {
9+ /// The algorithm to use for diffing. If this is `None`, `diff.algorithm` will be used.
10+ pub diff_algorithm : Option < gix_diff:: blob:: Algorithm > ,
11+ /// The ranges to blame in the file.
12+ pub ranges : gix_blame:: BlameRanges ,
13+ /// Don't consider commits before the given date.
14+ pub since : Option < gix_date:: Time > ,
15+ /// Determine if rename tracking should be performed, and how.
16+ pub rewrites : Option < gix_diff:: Rewrites > ,
17+ }
18+
619impl Repository {
720 /// Produce a list of consecutive [`gix_blame::BlameEntry`] instances. Each `BlameEntry`
821 /// corresponds to a hunk of consecutive lines of the file at `suspect:<file_path>` that got
@@ -13,11 +26,30 @@ impl Repository {
1326 & self ,
1427 file_path : & BStr ,
1528 suspect : impl Into < ObjectId > ,
16- options : gix_blame :: Options ,
29+ options : Options ,
1730 ) -> Result < gix_blame:: Outcome , blame_file:: Error > {
1831 let cache: Option < gix_commitgraph:: Graph > = self . commit_graph_if_enabled ( ) ?;
1932 let mut resource_cache = self . diff_resource_cache_for_tree_diff ( ) ?;
2033
34+ let Options {
35+ diff_algorithm,
36+ ranges,
37+ since,
38+ rewrites,
39+ } = options;
40+ let diff_algorithm = match diff_algorithm {
41+ Some ( diff_algorithm) => diff_algorithm,
42+ None => self . diff_algorithm ( ) ?,
43+ } ;
44+
45+ let options = gix_blame:: Options {
46+ diff_algorithm,
47+ ranges,
48+ since,
49+ rewrites,
50+ debug_track_path : false ,
51+ } ;
52+
2153 let outcome = gix_blame:: file (
2254 & self . objects ,
2355 suspect. into ( ) ,
0 commit comments