Skip to content

Commit

Permalink
Merge pull request GitoxideLabs#1755 from cruessler/shortcut-tree-dif…
Browse files Browse the repository at this point in the history
…fing-minor-cleanups

Prefix variant to disambiguate from continue
  • Loading branch information
Byron authored Jan 11, 2025
2 parents 34096a5 + ec3cdf1 commit 25c2646
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions gix-blame/src/file/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ fn tree_diff_at_file_path(
}

fn visit(&mut self, change: gix_diff::tree::visit::Change) -> gix_diff::tree::visit::Action {
use gix_diff::tree::visit::Action::*;
use gix_diff::tree::visit;
use gix_diff::tree::visit::Change::*;

if self.inner.path() == self.interesting_path {
Expand Down Expand Up @@ -438,11 +438,9 @@ fn tree_diff_at_file_path(
},
});

// When we return `Cancel`, `gix_diff::tree` will convert this `Cancel` into an
// `Err(...)`. Keep this in mind when using `FindChangeToPath`.
Cancel
visit::Action::Cancel
} else {
Continue
visit::Action::Continue
}
}
}
Expand All @@ -452,9 +450,6 @@ fn tree_diff_at_file_path(
stats.trees_diffed += 1;

match result {
// `recorder` cancels the traversal by returning `Cancel` when a change to `file_path` is
// found. `gix_diff::tree` converts `Cancel` into `Err(Cancelled)` which is why we match on
// `Err(Cancelled)` in addition to `Ok`.
Ok(_) | Err(gix_diff::tree::Error::Cancelled) => Ok(recorder.change),
Err(error) => Err(Error::DiffTree(error)),
}
Expand Down

0 comments on commit 25c2646

Please sign in to comment.