File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Expand file tree Collapse file tree 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> {
133133 Ok ( Platform {
134134 state : Default :: default ( ) ,
135135 lhs : self ,
136- location : None ,
136+ location : Some ( Location :: Path ) ,
137137 rewrites : self . repo . config . diff_renames ( ) ?. unwrap_or_default ( ) . into ( ) ,
138138 } )
139139 }
@@ -150,13 +150,19 @@ pub struct Platform<'a, 'repo> {
150150
151151/// Configuration
152152impl 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+
153159 /// Keep track of file-names, which makes the [`location`][Change::location] field usable with the filename of the changed item.
154160 pub fn track_filename ( & mut self ) -> & mut Self {
155161 self . location = Some ( Location :: FileName ) ;
156162 self
157163 }
158164
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).
160166 ///
161167 /// This makes the [`location`][Change::location] field usable.
162168 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 {
2424 let ( expected_previous_entry_mode, expected_previous_data, expected_entry_mode, expected_data) =
2525 expected_modifications[ i] ;
2626
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"
3130 ) ;
3231 match change {
3332 Change :: Modification {
You can’t perform that action at this time.
0 commit comments