mirror of
https://github.com/martinvonz/jj.git
synced 2025-05-16 04:34:27 +00:00
tree: reuse caller-provided path in known_sub_tree(), mark it as private
This commit is contained in:
parent
db7facb78e
commit
55f93bfa04
@ -153,9 +153,8 @@ impl Tree {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn known_sub_tree(&self, name: &RepoPathComponent, id: &TreeId) -> Tree {
|
fn known_sub_tree(&self, subdir: &RepoPath, id: &TreeId) -> Tree {
|
||||||
let subdir = self.dir.join(name);
|
self.store.get_tree(subdir, id).unwrap()
|
||||||
self.store.get_tree(&subdir, id).unwrap()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sub_tree_recursive(&self, components: &[RepoPathComponent]) -> Option<Tree> {
|
fn sub_tree_recursive(&self, components: &[RepoPathComponent]) -> Option<Tree> {
|
||||||
@ -265,7 +264,7 @@ impl Iterator for TreeEntriesIterator<'_> {
|
|||||||
if self.matcher.visit(&path).is_nothing() {
|
if self.matcher.visit(&path).is_nothing() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let subtree = top.tree.known_sub_tree(entry.name(), id);
|
let subtree = top.tree.known_sub_tree(&path, id);
|
||||||
self.stack.push(TreeEntriesDirItem::new(subtree));
|
self.stack.push(TreeEntriesDirItem::new(subtree));
|
||||||
}
|
}
|
||||||
value => {
|
value => {
|
||||||
@ -439,11 +438,11 @@ impl TreeDiffDirItem {
|
|||||||
) -> Self {
|
) -> Self {
|
||||||
let subdir_path = self.path.join(name);
|
let subdir_path = self.path.join(name);
|
||||||
let before_tree = match before {
|
let before_tree = match before {
|
||||||
Some(TreeValue::Tree(id_before)) => self.tree1.known_sub_tree(name, id_before),
|
Some(TreeValue::Tree(id_before)) => self.tree1.known_sub_tree(&subdir_path, id_before),
|
||||||
_ => Tree::null(self.tree1.store().clone(), subdir_path.clone()),
|
_ => Tree::null(self.tree1.store().clone(), subdir_path.clone()),
|
||||||
};
|
};
|
||||||
let after_tree = match after {
|
let after_tree = match after {
|
||||||
Some(TreeValue::Tree(id_after)) => self.tree2.known_sub_tree(name, id_after),
|
Some(TreeValue::Tree(id_after)) => self.tree2.known_sub_tree(&subdir_path, id_after),
|
||||||
_ => Tree::null(self.tree2.store().clone(), subdir_path.clone()),
|
_ => Tree::null(self.tree2.store().clone(), subdir_path.clone()),
|
||||||
};
|
};
|
||||||
Self::new(subdir_path, before_tree, after_tree)
|
Self::new(subdir_path, before_tree, after_tree)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user