File tree Expand file tree Collapse file tree 3 files changed +20
-16
lines changed Expand file tree Collapse file tree 3 files changed +20
-16
lines changed Original file line number Diff line number Diff line change @@ -168,13 +168,13 @@ impl<T: Change> Tracker<T> {
168
168
return Some ( change) ;
169
169
} ;
170
170
171
- let relation = change
172
- . relation ( )
173
- . filter ( |_| matches ! ( change_kind, ChangeKind :: Addition | ChangeKind :: Deletion ) ) ;
174
171
let entry_kind = change. entry_mode ( ) . kind ( ) ;
175
172
if entry_kind == EntryKind :: Commit {
176
173
return Some ( change) ;
177
174
}
175
+ let relation = change
176
+ . relation ( )
177
+ . filter ( |_| matches ! ( change_kind, ChangeKind :: Addition | ChangeKind :: Deletion ) ) ;
178
178
if let ( None , EntryKind :: Tree ) = ( relation, entry_kind) {
179
179
return Some ( change) ;
180
180
} ;
Original file line number Diff line number Diff line change @@ -36,8 +36,10 @@ pub trait Visit {
36
36
/// The state required to run [tree-diffs](super::tree()).
37
37
#[ derive( Default , Clone ) ]
38
38
pub struct State {
39
- buf1 : Vec < u8 > ,
40
- buf2 : Vec < u8 > ,
39
+ /// A buffer for object data.
40
+ pub buf1 : Vec < u8 > ,
41
+ /// Another buffer for object data.
42
+ pub buf2 : Vec < u8 > ,
41
43
trees : VecDeque < TreeInfoTuple > ,
42
44
change_id : visit:: ChangeId ,
43
45
}
Original file line number Diff line number Diff line change @@ -525,17 +525,19 @@ fn rename_by_50_percent_similarity() -> crate::Result {
525
525
#[ test]
526
526
fn directories_without_relation_are_ignored ( ) -> crate :: Result {
527
527
let mut track = util:: new_tracker ( Default :: default ( ) ) ;
528
- let tree_without_relation = Change {
529
- id : NULL_ID ,
530
- kind : ChangeKind :: Deletion ,
531
- mode : EntryKind :: Tree . into ( ) ,
532
- relation : None ,
533
- } ;
534
- assert_eq ! (
535
- track. try_push_change( tree_without_relation, "dir" . into( ) ) ,
536
- Some ( tree_without_relation) ,
537
- "trees, or non-blobs, are ignored, particularly when they have no relation"
538
- ) ;
528
+ for mode in [ EntryKind :: Tree , EntryKind :: Commit ] {
529
+ let tree_without_relation = Change {
530
+ id : NULL_ID ,
531
+ kind : ChangeKind :: Deletion ,
532
+ mode : mode. into ( ) ,
533
+ relation : None ,
534
+ } ;
535
+ assert_eq ! (
536
+ track. try_push_change( tree_without_relation, "dir" . into( ) ) ,
537
+ Some ( tree_without_relation) ,
538
+ "trees and submodules are ignored, particularly when they have no relation"
539
+ ) ;
540
+ }
539
541
Ok ( ( ) )
540
542
}
541
543
You can’t perform that action at this time.
0 commit comments