File tree 2 files changed +11
-6
lines changed
2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ impl<'repo> Tree<'repo> {
133
133
Ok ( Platform {
134
134
state : Default :: default ( ) ,
135
135
lhs : self ,
136
- location : None ,
136
+ location : Some ( Location :: Path ) ,
137
137
rewrites : self . repo . config . diff_renames ( ) ?. unwrap_or_default ( ) . into ( ) ,
138
138
} )
139
139
}
@@ -150,13 +150,19 @@ pub struct Platform<'a, 'repo> {
150
150
151
151
/// Configuration
152
152
impl Platform < ' _ , ' _ > {
153
+ /// Do not keep track of filepaths at all, which will leave all [`location`][Change::location] fields empty.
154
+ pub fn no_locations ( & mut self ) -> & mut Self {
155
+ self . location = Some ( Location :: FileName ) ;
156
+ self
157
+ }
158
+
153
159
/// Keep track of file-names, which makes the [`location`][Change::location] field usable with the filename of the changed item.
154
160
pub fn track_filename ( & mut self ) -> & mut Self {
155
161
self . location = Some ( Location :: FileName ) ;
156
162
self
157
163
}
158
164
159
- /// Keep track of the entire path of a change, relative to the repository.
165
+ /// Keep track of the entire path of a change, relative to the repository. (default).
160
166
///
161
167
/// This makes the [`location`][Change::location] field usable.
162
168
pub fn track_path ( & mut self ) -> & mut Self {
Original file line number Diff line number Diff line change @@ -24,10 +24,9 @@ fn changes_against_tree_modified() -> crate::Result {
24
24
let ( expected_previous_entry_mode, expected_previous_data, expected_entry_mode, expected_data) =
25
25
expected_modifications[ i] ;
26
26
27
- assert_eq ! (
28
- change. location( ) ,
29
- "" ,
30
- "without configuration the location field is empty"
27
+ assert ! (
28
+ !change. location( ) . is_empty( ) ,
29
+ "without configuration the location field is set"
31
30
) ;
32
31
match change {
33
32
Change :: Modification {
You can’t perform that action at this time.
0 commit comments