@@ -5,12 +5,9 @@ use crate::{Blob, ObjectDetached};
55pub  mod  diff { 
66    use  std:: ops:: Range ; 
77
8-     use  gix_diff:: blob:: { platform:: prepare_diff:: Operation ,   ResourceKind } ; 
8+     use  gix_diff:: blob:: platform:: prepare_diff:: Operation ; 
99
10-     use  crate :: { 
11-         bstr:: ByteSlice , 
12-         object:: { blob:: diff:: lines:: Change ,  tree:: diff:: change:: Event } , 
13-     } ; 
10+     use  crate :: bstr:: ByteSlice ; 
1411
1512    /// A platform to keep temporary information to perform line diffs on modified blobs. 
1613     /// 
@@ -21,99 +18,10 @@ pub mod diff {
2118
2219    /// 
2320     pub  mod  init { 
24-         /// The error returned by [`Platform::from_tree_change()`][super::Platform::from_tree_change()] . 
21+         /// The error returned by [`object::tree::diff::Change::diff`](crate::object::tree::diff::Change::diff()) . 
2522         pub  type  Error  = gix_diff:: blob:: platform:: set_resource:: Error ; 
2623    } 
2724
28-     impl < ' a >  Platform < ' a >  { 
29-         /// Produce a platform for performing various diffs after obtaining the data from a single `tree_change`. 
30-          pub  fn  from_tree_change ( 
31-             tree_change :  & crate :: object:: tree:: diff:: Change < ' _ ,  ' _ ,  ' _ > , 
32-             resource_cache :  & ' a  mut  gix_diff:: blob:: Platform , 
33-         )  -> Result < Platform < ' a > ,  init:: Error >  { 
34-             match  tree_change. event  { 
35-                 Event :: Addition  {  entry_mode,  id }  => { 
36-                     resource_cache. set_resource ( 
37-                         id. repo . object_hash ( ) . null ( ) , 
38-                         entry_mode. kind ( ) , 
39-                         tree_change. location , 
40-                         ResourceKind :: OldOrSource , 
41-                         & id. repo . objects , 
42-                     ) ?; 
43-                     resource_cache. set_resource ( 
44-                         id. inner , 
45-                         entry_mode. kind ( ) , 
46-                         tree_change. location , 
47-                         ResourceKind :: NewOrDestination , 
48-                         & id. repo . objects , 
49-                     ) ?; 
50-                 } 
51-                 Event :: Deletion  {  entry_mode,  id }  => { 
52-                     resource_cache. set_resource ( 
53-                         id. inner , 
54-                         entry_mode. kind ( ) , 
55-                         tree_change. location , 
56-                         ResourceKind :: OldOrSource , 
57-                         & id. repo . objects , 
58-                     ) ?; 
59-                     resource_cache. set_resource ( 
60-                         id. repo . object_hash ( ) . null ( ) , 
61-                         entry_mode. kind ( ) , 
62-                         tree_change. location , 
63-                         ResourceKind :: NewOrDestination , 
64-                         & id. repo . objects , 
65-                     ) ?; 
66-                 } 
67-                 Event :: Modification  { 
68-                     previous_entry_mode, 
69-                     previous_id, 
70-                     entry_mode, 
71-                     id, 
72-                 }  => { 
73-                     resource_cache. set_resource ( 
74-                         previous_id. inner , 
75-                         previous_entry_mode. kind ( ) , 
76-                         tree_change. location , 
77-                         ResourceKind :: OldOrSource , 
78-                         & previous_id. repo . objects , 
79-                     ) ?; 
80-                     resource_cache. set_resource ( 
81-                         id. inner , 
82-                         entry_mode. kind ( ) , 
83-                         tree_change. location , 
84-                         ResourceKind :: NewOrDestination , 
85-                         & id. repo . objects , 
86-                     ) ?; 
87-                 } 
88-                 Event :: Rewrite  { 
89-                     source_location, 
90-                     source_entry_mode, 
91-                     source_id, 
92-                     entry_mode, 
93-                     id, 
94-                     diff :  _, 
95-                     copy :  _, 
96-                 }  => { 
97-                     resource_cache. set_resource ( 
98-                         source_id. inner , 
99-                         source_entry_mode. kind ( ) , 
100-                         source_location, 
101-                         ResourceKind :: OldOrSource , 
102-                         & source_id. repo . objects , 
103-                     ) ?; 
104-                     resource_cache. set_resource ( 
105-                         id. inner , 
106-                         entry_mode. kind ( ) , 
107-                         tree_change. location , 
108-                         ResourceKind :: NewOrDestination , 
109-                         & id. repo . objects , 
110-                     ) ?; 
111-                 } 
112-             } 
113-             Ok ( Self  {  resource_cache } ) 
114-         } 
115-     } 
116- 
11725    /// 
11826     pub  mod  lines { 
11927        use  crate :: bstr:: BStr ; 
@@ -195,11 +103,11 @@ pub mod diff {
195103                        let  hunk_before = & lines[ ..end_of_before] ; 
196104                        let  hunk_after = & lines[ end_of_before..] ; 
197105                        if  hunk_after. is_empty ( )  { 
198-                             err = process_hunk ( Change :: Deletion  {  lines :  hunk_before } ) . err ( ) ; 
106+                             err = process_hunk ( lines :: Change :: Deletion  {  lines :  hunk_before } ) . err ( ) ; 
199107                        }  else  if  hunk_before. is_empty ( )  { 
200-                             err = process_hunk ( Change :: Addition  {  lines :  hunk_after } ) . err ( ) ; 
108+                             err = process_hunk ( lines :: Change :: Addition  {  lines :  hunk_after } ) . err ( ) ; 
201109                        }  else  { 
202-                             err = process_hunk ( Change :: Modification  { 
110+                             err = process_hunk ( lines :: Change :: Modification  { 
203111                                lines_before :  hunk_before, 
204112                                lines_after :  hunk_after, 
205113                            } ) 
0 commit comments