Detect conflicts during merge conflict#508
Conversation
596a8e0 to
3dd6844
Compare
Signed-off-by: Atanas Dinov <atanas.dinov@suse.com>
3dd6844 to
5d615bc
Compare
davidcassany
left a comment
There was a problem hiding this comment.
I appreciate this is in draft review, hence this is probably not ready for review. If you don't mind I have a couple of comments regarding the implementation.
I am wondering if instead of gathering a full diff for both cases wouldn't it be simpler to diff one and then from a first list of modified files then use it to diff them on the other side of the 3 way merge. After all we want to detect conflicts so any file not included in the first diff is known not to be a conflict candidate.
| r := regexp.MustCompile(`(([-+ct.])[p.][u.][g.][x.][a.])\s+(.*)`) | ||
|
|
||
| scanner := bufio.NewScanner(statusF) | ||
| for scanner.Scan() { |
There was a problem hiding this comment.
Wouldn't it be possible to check for conflict on file per file basis here in this loop instead of walking the whole tree? So here we just check the user modified tree if it is also modified by the new image. So we only diff the files which are potentially conflicting and we do not need to parse again snapper diff status, load it in memory, iterate over it again and walk the whole tree of the snapshot.
So we basically create the list of files to merge and the list of conflicting files together at the same time.
| Old string // old unmodified tree | ||
| New string // new base tree where modifications should be applied | ||
| Modified string // modified tree on top of the old tree | ||
| NewStock string // new stock snapshot path (for conflict detection) |
There was a problem hiding this comment.
I don't think this is needed. This has the same content as New at merge time.
No description provided.