mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-15 08:53:16 +00:00
tree: use RepoPathComponent in merge_tree_value()
This commit is contained in:
parent
5ece748dff
commit
6b609a8a9f
1 changed files with 5 additions and 11 deletions
|
@ -515,14 +515,8 @@ pub fn merge_trees(
|
||||||
// value
|
// value
|
||||||
} else {
|
} else {
|
||||||
// The two sides changed in different ways
|
// The two sides changed in different ways
|
||||||
let new_value = merge_tree_value(
|
let new_value =
|
||||||
store,
|
merge_tree_value(store, dir, &basename, maybe_base, maybe_side1, maybe_side2)?;
|
||||||
dir,
|
|
||||||
basename.as_str(),
|
|
||||||
maybe_base,
|
|
||||||
maybe_side1,
|
|
||||||
maybe_side2,
|
|
||||||
)?;
|
|
||||||
match new_value {
|
match new_value {
|
||||||
None => new_tree.remove(basename.as_str()),
|
None => new_tree.remove(basename.as_str()),
|
||||||
Some(value) => new_tree.set(basename.as_str().to_owned(), value),
|
Some(value) => new_tree.set(basename.as_str().to_owned(), value),
|
||||||
|
@ -535,7 +529,7 @@ pub fn merge_trees(
|
||||||
fn merge_tree_value(
|
fn merge_tree_value(
|
||||||
store: &StoreWrapper,
|
store: &StoreWrapper,
|
||||||
dir: &RepoPath,
|
dir: &RepoPath,
|
||||||
basename: &str,
|
basename: &RepoPathComponent,
|
||||||
maybe_base: Option<&TreeValue>,
|
maybe_base: Option<&TreeValue>,
|
||||||
maybe_side1: Option<&TreeValue>,
|
maybe_side1: Option<&TreeValue>,
|
||||||
maybe_side2: Option<&TreeValue>,
|
maybe_side2: Option<&TreeValue>,
|
||||||
|
@ -551,7 +545,7 @@ fn merge_tree_value(
|
||||||
Some(TreeValue::Tree(side1)),
|
Some(TreeValue::Tree(side1)),
|
||||||
Some(TreeValue::Tree(side2)),
|
Some(TreeValue::Tree(side2)),
|
||||||
) => {
|
) => {
|
||||||
let subdir = dir.join(&RepoPathComponent::from(basename));
|
let subdir = dir.join(basename);
|
||||||
let merged_tree_id = merge_trees(
|
let merged_tree_id = merge_trees(
|
||||||
&store.get_tree(&subdir, &side1).unwrap(),
|
&store.get_tree(&subdir, &side1).unwrap(),
|
||||||
&store.get_tree(&subdir, &base).unwrap(),
|
&store.get_tree(&subdir, &base).unwrap(),
|
||||||
|
@ -588,7 +582,7 @@ fn merge_tree_value(
|
||||||
*side1_executable
|
*side1_executable
|
||||||
};
|
};
|
||||||
|
|
||||||
let filename = dir.join(&RepoPathComponent::from(basename));
|
let filename = dir.join(&basename);
|
||||||
let mut base_content = vec![];
|
let mut base_content = vec![];
|
||||||
store
|
store
|
||||||
.read_file(&filename, &base_id)?
|
.read_file(&filename, &base_id)?
|
||||||
|
|
Loading…
Reference in a new issue