ok/jj
1
0
Fork 0
forked from mirrors/jj

tree: avoid "file" in name of variables that can be non-files

This commit is contained in:
Martin von Zweigbergk 2023-07-06 06:53:28 -07:00 committed by Martin von Zweigbergk
parent 76b1d53b1d
commit 2bc58ebacf

View file

@ -457,17 +457,16 @@ impl Iterator for TreeDiffIterator<'_> {
} else {
self.stack.len()
};
// Note: whenever we say "file" below, it may also be a symlink or a conflict.
if self.matcher.matches(&path) {
if !tree_before && tree_after {
if let Some(file_before) = before {
return Some((path, Diff::Removed(file_before.clone())));
if let Some(value_before) = before {
return Some((path, Diff::Removed(value_before.clone())));
}
} else if tree_before && !tree_after {
if let Some(file_after) = after {
if let Some(value_after) = after {
self.stack.insert(
post_subdir,
TreeDiffItem::File(path, Diff::Added(file_after.clone())),
TreeDiffItem::File(path, Diff::Added(value_after.clone())),
);
}
} else if !tree_before && !tree_after {