pw icon indicating copy to clipboard operation
pw copied to clipboard

Mark real conflicts during merge

Open gioele opened this issue 10 years ago • 0 comments

Commit 468cd8ff6a3479a4bb0e5a9c42f48b90f65d7675 introduced a new merge driver that avoids conflicts during merges by adding to the DB all the entries that have been changed in at least one branch. This strategy solves perfectly the classic case of a conflict caused by two simultaneous additions to the same DB. However, if the same entry has been edited in both branches, this strategy will include in the final DB both versions. This is OK because no information is lost but there should be a way to warn the user about this problem.

For example when the branch with this diff

 1p::abc:entry1
- 1p::def:entry2
+1p::c00:entryAAA
 1p::bbb:entry3

is merged with the branch with this diff

 1p::abc:entry1
- 1p::def:entry2
+1p::832:entryBBB
 1p::bbb:entry3

the result DB will be

1p::abc:entry1
1p::c00:entryAAA
1p::832:entryBBB
1p::bbb:entry3

After the merge pw has no way to detect that two different entries (entryAAA and entryBBB) have replaced entry2.

One possible solution is to

  1. use git merge-file without --union,
  2. find entries that are part of real conflicts,
  3. run git merge-file --union,
  4. add c (for conflict) to the version information field of the problematic entries.

gioele avatar Dec 29 '15 18:12 gioele