mirror of
https://github.com/martinvonz/jj.git
synced 2025-02-06 03:22:59 +00:00
merge: fast-path trivial merge of 1-way "conflicts"
I don't think we call `trivial_merge()` for 1-way "conflicts" yet, but I'll probably end up doing that soon.
This commit is contained in:
parent
9c486ebe45
commit
b8f6a48c66
1 changed files with 4 additions and 2 deletions
|
@ -29,8 +29,10 @@ where
|
||||||
"trivial_merge() requires exactly one more adds than removes"
|
"trivial_merge() requires exactly one more adds than removes"
|
||||||
);
|
);
|
||||||
|
|
||||||
// Optimize the common case of a 3-way merge
|
// Optimize the common cases of 3-way merge and 1-way (non-)merge
|
||||||
if adds.len() == 2 {
|
if adds.len() == 1 {
|
||||||
|
return Some(&adds[0]);
|
||||||
|
} else if adds.len() == 2 {
|
||||||
return if adds[0] == adds[1] {
|
return if adds[0] == adds[1] {
|
||||||
Some(&adds[0])
|
Some(&adds[0])
|
||||||
} else if adds[0] == removes[0] {
|
} else if adds[0] == removes[0] {
|
||||||
|
|
Loading…
Reference in a new issue