History

refactor

Sebastian Thiel committed 5 years ago

Commit 082f8d01 parent bd4d21e1 file · +13 −9Browse files

Showing the changes to git-diff/src (1 of 1 file). Show all

Unified · Split

git-diff/src/tree/changes.rs+13−9
@@ -12,7 +12,7 @@ quick_error! { · 11 unmodified lines
12 #[derive(Debug)]12 #[derive(Debug)]
13 #[allow(missing_docs)]13 #[allow(missing_docs)]
14 pub enum Error {14 pub enum Error {
15 NotFound(oid: ObjectId) {15 NotFound { oid: ObjectId } {
16 display("The object {} referenced by the tree was not found in the database", oid)16 display("The object {} referenced by the tree was not found in the database", oid)
17 }17 }
18 Cancelled {18 Cancelled {
@@ -77,20 +77,24 @@ impl<'a> tree::Changes<'a> { · 58 unmodified lines
77 match state.trees.pop_front() {77 match state.trees.pop_front() {
78 Some((None, Some(rhs))) => {78 Some((None, Some(rhs))) => {
79 delegate.set_current_path(rhs.parent_path_id.clone());79 delegate.set_current_path(rhs.parent_path_id.clone());
80 rhs_entries =80 rhs_entries = peekable(
81 peekable(locate(&rhs.tree_id, &mut state.buf2).ok_or(Error::NotFound(rhs.tree_id))?);81 locate(&rhs.tree_id, &mut state.buf2).ok_or(Error::NotFound { oid: rhs.tree_id })?,
82 );
82 }83 }
83 Some((Some(lhs), Some(rhs))) => {84 Some((Some(lhs), Some(rhs))) => {
84 delegate.set_current_path(lhs.parent_path_id.clone());85 delegate.set_current_path(lhs.parent_path_id.clone());
85 lhs_entries =86 lhs_entries = peekable(
86 peekable(locate(&lhs.tree_id, &mut state.buf1).ok_or(Error::NotFound(lhs.tree_id))?);87 locate(&lhs.tree_id, &mut state.buf1).ok_or(Error::NotFound { oid: lhs.tree_id })?,
87 rhs_entries =88 );
88 peekable(locate(&rhs.tree_id, &mut state.buf2).ok_or(Error::NotFound(rhs.tree_id))?);89 rhs_entries = peekable(
90 locate(&rhs.tree_id, &mut state.buf2).ok_or(Error::NotFound { oid: rhs.tree_id })?,
91 );
89 }92 }
90 Some((Some(lhs), None)) => {93 Some((Some(lhs), None)) => {
91 delegate.set_current_path(lhs.parent_path_id.clone());94 delegate.set_current_path(lhs.parent_path_id.clone());
92 lhs_entries =95 lhs_entries = peekable(
93 peekable(locate(&lhs.tree_id, &mut state.buf1).ok_or(Error::NotFound(lhs.tree_id))?);96 locate(&lhs.tree_id, &mut state.buf1).ok_or(Error::NotFound { oid: lhs.tree_id })?,
97 );
94 }98 }
95 Some((None, None)) => unreachable!("BUG: it makes no sense to fill the stack with empties"),99 Some((None, None)) => unreachable!("BUG: it makes no sense to fill the stack with empties"),
96 None => return Ok(()),100 None => return Ok(()),

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t