revset: pass valid file paths to diff_contains() error

This commit is contained in:
Yuya Nishihara 2024-08-12 13:07:26 +09:00
parent 145f942d99
commit c651930e9a

View File

@ -1169,7 +1169,7 @@ fn matches_diff_from_parent(
text_pattern: &StringPattern, text_pattern: &StringPattern,
files_matcher: &dyn Matcher, files_matcher: &dyn Matcher,
) -> BackendResult<bool> { ) -> BackendResult<bool> {
let copy_records = Default::default(); let copy_records = Default::default(); // TODO handle copy tracking
let parents: Vec<_> = commit.parents().try_collect()?; let parents: Vec<_> = commit.parents().try_collect()?;
let from_tree = let from_tree =
rewrite::merge_commit_trees_no_resolve_without_repo(store, &index, &parents)?.resolve()?; rewrite::merge_commit_trees_no_resolve_without_repo(store, &index, &parents)?.resolve()?;
@ -1180,14 +1180,14 @@ fn matches_diff_from_parent(
let mut diff_stream = materialized_diff_stream(store, tree_diff); let mut diff_stream = materialized_diff_stream(store, tree_diff);
async { async {
while let Some(MaterializedTreeDiffEntry { while let Some(MaterializedTreeDiffEntry {
source: _, // TODO handle copy tracking source,
target: path, target,
value: diff, value: diff,
}) = diff_stream.next().await }) = diff_stream.next().await
{ {
let (left_value, right_value) = diff?; let (left_value, right_value) = diff?;
let left_content = to_file_content(&path, left_value)?; let left_content = to_file_content(&source, left_value)?;
let right_content = to_file_content(&path, right_value)?; let right_content = to_file_content(&target, right_value)?;
// Filter lines prior to comparison. This might produce inferior // Filter lines prior to comparison. This might produce inferior
// hunks due to lack of contexts, but is way faster than full diff. // hunks due to lack of contexts, but is way faster than full diff.
let left_lines = match_lines(&left_content, text_pattern); let left_lines = match_lines(&left_content, text_pattern);