Unified · Split
| @@ -129,23 +129,27 @@ impl<'repo> Tree<'repo> { · 128 unmodified lines | |||
| 129 | res | 129 | res |
| 130 | } | 130 | } |
| 131 | ControlFlow::Break(entry) => { | 131 | ControlFlow::Break(entry) => { |
| 132 | let mapped = entry.map(|e| Entry { | 132 | let entry = if let Some(e) = entry { |
| 133 | inner: e.into(), | 133 | let inner = e.into(); |
| 134 | repo: self.repo, | 134 | |
| 135 | }); | 135 | if e.mode.is_tree() { |
| 136 | if let Some(entry) = &mapped { | 136 | let id = e.oid.to_owned(); |
| 137 | if entry.mode().is_tree() { | ||
| 138 | let id = entry.object_id(); | ||
| 139 | self.repo.find(&id, &mut self.data)?; | ||
| 140 | data_id = id; | 137 | data_id = id; |
| 138 | self.repo.find(&id, &mut self.data)?; | ||
| 141 | self.id = data_id; | 139 | self.id = data_id; |
| 142 | } | 140 | } |
| 143 | } | 141 | |
| 142 | Some(Entry { inner, repo: self.repo }) | ||
| 143 | } else { | ||
| 144 | None | ||
| 145 | }; | ||
| 146 | |||
| 144 | if data_id != self.id { | 147 | if data_id != self.id { |
| 145 | // Ensure that our data always matches our id, even if this means an extra lookup. | 148 | // Ensure that our data always matches our id, even if this means an extra lookup. |
| 146 | self.repo.find(&self.id, &mut self.data)?; | 149 | self.repo.find(&self.id, &mut self.data)?; |
| 147 | } | 150 | } |
| 148 | break Ok(mapped); | 151 | |
| 152 | break Ok(entry); | ||
| 149 | } | 153 | } |
| 150 | } | 154 | } |
| 151 | } | 155 | } |