1
1
use crate :: bstr:: { BStr , BString , ByteVec } ;
2
2
use crate :: ext:: ObjectIdExt ;
3
- use crate :: { Id , Repository , Tree } ;
3
+ use crate :: { Repository , Tree } ;
4
4
use git_object:: TreeRefIter ;
5
5
use git_odb:: FindExt ;
6
6
@@ -37,39 +37,44 @@ pub struct Change<'a, 'repo, 'other_repo> {
37
37
/// Otherwise this value is always an empty path.
38
38
pub location : & ' a BStr ,
39
39
/// The diff event itself to provide information about what would need to change.
40
- pub event : Event < ' repo , ' other_repo > ,
40
+ pub event : change :: Event < ' repo , ' other_repo > ,
41
41
}
42
42
43
- /// An event emitted when finding differences between two trees.
44
- #[ derive( Debug , Clone , Copy ) ]
45
- pub enum Event < ' repo , ' other_repo > {
46
- /// An entry was added, like the addition of a file or directory.
47
- Addition {
48
- /// The mode of the added entry.
49
- entry_mode : git_object:: tree:: EntryMode ,
50
- /// The object id of the added entry.
51
- id : Id < ' other_repo > ,
52
- } ,
53
- /// An entry was deleted, like the deletion of a file or directory.
54
- Deletion {
55
- /// The mode of the deleted entry.
56
- entry_mode : git_object:: tree:: EntryMode ,
57
- /// The object id of the deleted entry.
58
- id : Id < ' repo > ,
59
- } ,
60
- /// An entry was modified, e.g. changing the contents of a file adjusts its object id and turning
61
- /// a file into a symbolic link adjusts its mode.
62
- Modification {
63
- /// The mode of the entry before the modification.
64
- previous_entry_mode : git_object:: tree:: EntryMode ,
65
- /// The object id of the entry before the modification.
66
- previous_id : Id < ' repo > ,
67
-
68
- /// The mode of the entry after the modification.
69
- entry_mode : git_object:: tree:: EntryMode ,
70
- /// The object id after the modification.
71
- id : Id < ' other_repo > ,
72
- } ,
43
+ ///
44
+ pub mod change {
45
+ use crate :: Id ;
46
+
47
+ /// An event emitted when finding differences between two trees.
48
+ #[ derive( Debug , Clone , Copy ) ]
49
+ pub enum Event < ' repo , ' other_repo > {
50
+ /// An entry was added, like the addition of a file or directory.
51
+ Addition {
52
+ /// The mode of the added entry.
53
+ entry_mode : git_object:: tree:: EntryMode ,
54
+ /// The object id of the added entry.
55
+ id : Id < ' other_repo > ,
56
+ } ,
57
+ /// An entry was deleted, like the deletion of a file or directory.
58
+ Deletion {
59
+ /// The mode of the deleted entry.
60
+ entry_mode : git_object:: tree:: EntryMode ,
61
+ /// The object id of the deleted entry.
62
+ id : Id < ' repo > ,
63
+ } ,
64
+ /// An entry was modified, e.g. changing the contents of a file adjusts its object id and turning
65
+ /// a file into a symbolic link adjusts its mode.
66
+ Modification {
67
+ /// The mode of the entry before the modification.
68
+ previous_entry_mode : git_object:: tree:: EntryMode ,
69
+ /// The object id of the entry before the modification.
70
+ previous_id : Id < ' repo > ,
71
+
72
+ /// The mode of the entry after the modification.
73
+ entry_mode : git_object:: tree:: EntryMode ,
74
+ /// The object id after the modification.
75
+ id : Id < ' other_repo > ,
76
+ } ,
77
+ }
73
78
}
74
79
75
80
/// Diffing
@@ -174,11 +179,11 @@ where
174
179
fn visit ( & mut self , change : git_diff:: tree:: visit:: Change ) -> git_diff:: tree:: visit:: Action {
175
180
use git_diff:: tree:: visit:: Change :: * ;
176
181
let event = match change {
177
- Addition { entry_mode, oid } => Event :: Addition {
182
+ Addition { entry_mode, oid } => change :: Event :: Addition {
178
183
entry_mode,
179
184
id : oid. attach ( self . other_repo ) ,
180
185
} ,
181
- Deletion { entry_mode, oid } => Event :: Deletion {
186
+ Deletion { entry_mode, oid } => change :: Event :: Deletion {
182
187
entry_mode,
183
188
id : oid. attach ( self . repo ) ,
184
189
} ,
@@ -187,7 +192,7 @@ where
187
192
previous_oid,
188
193
entry_mode,
189
194
oid,
190
- } => Event :: Modification {
195
+ } => change :: Event :: Modification {
191
196
previous_entry_mode,
192
197
entry_mode,
193
198
previous_id : previous_oid. attach ( self . repo ) ,
0 commit comments