tree_builder: remove unnecessary has_overrides() method

It's easy to instead check if the new tree id is different from the
tree id.
This commit is contained in:
Martin von Zweigbergk 2023-08-23 23:47:45 -07:00 committed by Martin von Zweigbergk
parent 598cfcb89b
commit 2fe4372121
2 changed files with 3 additions and 6 deletions

View file

@ -50,10 +50,6 @@ impl TreeBuilder {
self.store.as_ref()
}
pub fn has_overrides(&self) -> bool {
!self.overrides.is_empty()
}
pub fn set(&mut self, path: RepoPath, value: TreeValue) {
assert!(!path.is_root());
self.overrides.insert(path, Override::Replace(value));

View file

@ -717,8 +717,9 @@ impl TreeState {
}
});
trace_span!("write tree").in_scope(|| {
is_dirty |= tree_builder.has_overrides();
self.tree_id = tree_builder.write_tree();
let new_tree_id = tree_builder.write_tree();
is_dirty |= new_tree_id != self.tree_id;
self.tree_id = new_tree_id;
});
if cfg!(debug_assertions) {
let tree = self.current_tree().unwrap();