mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-28 07:20:11 +00:00
tree: return early when trying to resolve modify/delete conflict
Modify/delete conflicts cannot be automatically resolved, so there's no point in wasting resources calculating the diff(s).
This commit is contained in:
parent
3dfedf5814
commit
7f334656b1
1 changed files with 6 additions and 0 deletions
|
@ -653,6 +653,12 @@ fn try_resolve_file_conflict(
|
||||||
filename: &RepoPath,
|
filename: &RepoPath,
|
||||||
conflict: &Conflict,
|
conflict: &Conflict,
|
||||||
) -> Result<Option<(Vec<u8>, bool)>, TreeMergeError> {
|
) -> Result<Option<(Vec<u8>, bool)>, TreeMergeError> {
|
||||||
|
// If the file was missing from any side (typically a modify/delete conflict),
|
||||||
|
// we can't automatically merge it.
|
||||||
|
if conflict.adds.len() != conflict.removes.len() + 1 {
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
|
|
||||||
// If there are any non-file parts in the conflict, we can't merge it. We check
|
// If there are any non-file parts in the conflict, we can't merge it. We check
|
||||||
// early so we don't waste time reading file contents if we can't merge them
|
// early so we don't waste time reading file contents if we can't merge them
|
||||||
// anyway. At the same time we determine whether the resulting file should
|
// anyway. At the same time we determine whether the resulting file should
|
||||||
|
|
Loading…
Reference in a new issue