Skip to content

Commit

Permalink
Prep for possible language-aware conflict splitting
Browse files Browse the repository at this point in the history
  • Loading branch information
yairchu committed Nov 25, 2024
1 parent 33f49f0 commit 871889c
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/Resolution.hs
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,20 @@ resolveContent opts =
foldMap go
where
go (Left line) = NewContent mempty (unlines [line])
go (Right conflict)
| opts.splitMarkers =
r
{ result =
if r.result.failedToResolve + r.result.reducedConflicts > 0
then mempty {reducedConflicts = 1} -- The split is a reduction
else mempty {resolvedSuccessfully = 1}
}
| otherwise = resolve conflict
where
s = splitConflict conflict
r = foldMap resolve s
go (Right conflict) =
r
{ result =
case parts of
[_] -> r.result
_ | r.result.failedToResolve + r.result.reducedConflicts > 0 ->
mempty {reducedConflicts = 1} -- The split is a reduction
| otherwise -> mempty {resolvedSuccessfully = 1}
}
where
parts
| opts.splitMarkers = splitConflict conflict
| otherwise = [conflict]
r = foldMap resolve parts
resolve conflict =
formatResolution $ resolveConflict opts $
(if opts.lineEndings then lineBreakFix else id) $
Expand Down

0 comments on commit 871889c

Please sign in to comment.