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> {
168168 return Some ( change) ;
169169 } ;
170170
171- let relation = change
172- . relation ( )
173- . filter ( |_| matches ! ( change_kind, ChangeKind :: Addition | ChangeKind :: Deletion ) ) ;
174171 let entry_kind = change. entry_mode ( ) . kind ( ) ;
175172 if entry_kind == EntryKind :: Commit {
176173 return Some ( change) ;
177174 }
175+ let relation = change
176+ . relation ( )
177+ . filter ( |_| matches ! ( change_kind, ChangeKind :: Addition | ChangeKind :: Deletion ) ) ;
178178 if let ( None , EntryKind :: Tree ) = ( relation, entry_kind) {
179179 return Some ( change) ;
180180 } ;
Original file line number Diff line number Diff line change @@ -36,8 +36,10 @@ pub trait Visit {
3636/// The state required to run [tree-diffs](super::tree()).
3737#[ derive( Default , Clone ) ]
3838pub 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 > ,
4143 trees : VecDeque < TreeInfoTuple > ,
4244 change_id : visit:: ChangeId ,
4345}
Original file line number Diff line number Diff line change @@ -525,17 +525,19 @@ fn rename_by_50_percent_similarity() -> crate::Result {
525525#[ test]
526526fn directories_without_relation_are_ignored ( ) -> crate :: Result {
527527 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+ }
539541 Ok ( ( ) )
540542}
541543
You can’t perform that action at this time.
0 commit comments