+10
-13
src/main.rs
+10
-13
src/main.rs
···
78
Ok(())
79
}
80
81
-
struct EntryScanner<'repo, 'a, C, P> {
82
-
current_tree: C,
83
-
parent_tree: P,
84
current_entry: Option<EntryRef<'repo, 'a>>,
85
parent_entry: Option<EntryRef<'repo, 'a>>,
86
}
87
88
-
impl<'repo, 'a, C, P> EntryScanner<'repo, 'a, C, P>
89
where
90
-
C: Iterator<Item = Result<EntryRef<'repo, 'a>, DecodeError>>,
91
-
P: Iterator<Item = Result<EntryRef<'repo, 'a>, DecodeError>>,
92
{
93
-
pub fn new(current_tree: C, parent_tree: P) -> Result<Self, DecodeError> {
94
let mut this = Self {
95
current_tree,
96
parent_tree,
···
129
while !self.is_complete() {
130
match (&self.current_entry, &self.parent_entry) {
131
(None, None) => break,
132
-
(Some(head_entry), Some(parent_entry))
133
-
if head_entry.filename() == parent_entry.filename() =>
134
-
{
135
-
if head_entry.id() != parent_entry.id() {
136
return Ok(self
137
.advance_both()?
138
.0
···
141
self.advance_both()?;
142
continue;
143
}
144
-
(Some(head_entry), Some(parent_entry)) => {
145
-
if head_entry.filename() < parent_entry.filename() {
146
return Ok(self
147
.advance_current()?
148
.map(|entry| Change::Create(entry.detach())));
···
78
Ok(())
79
}
80
81
+
struct EntryScanner<'repo, 'a, I> {
82
+
current_tree: I,
83
current_entry: Option<EntryRef<'repo, 'a>>,
84
+
parent_tree: I,
85
parent_entry: Option<EntryRef<'repo, 'a>>,
86
}
87
88
+
impl<'repo, 'a, I> EntryScanner<'repo, 'a, I>
89
where
90
+
I: Iterator<Item = Result<EntryRef<'repo, 'a>, DecodeError>>,
91
{
92
+
pub fn new(current_tree: I, parent_tree: I) -> Result<Self, DecodeError> {
93
let mut this = Self {
94
current_tree,
95
parent_tree,
···
128
while !self.is_complete() {
129
match (&self.current_entry, &self.parent_entry) {
130
(None, None) => break,
131
+
(Some(current), Some(parent)) if current.filename() == parent.filename() => {
132
+
if current.id() != parent.id() {
133
return Ok(self
134
.advance_both()?
135
.0
···
138
self.advance_both()?;
139
continue;
140
}
141
+
(Some(current), Some(parent)) => {
142
+
if current.filename() < parent.filename() {
143
return Ok(self
144
.advance_current()?
145
.map(|entry| Change::Create(entry.detach())));