4 ms·
Can I configure Git such that the merge of Haskell source code (any language will do) with base A: add x y = x + y left B: add z y = z + y and right
by giornogiovanna 7y ago
Can I configure Git such that the merge of Haskell source code (any language will do) with base A:
add x y = x + y
left B:
add z y = z + y
and right C:
add x w = x + w
succeeds without a conflict?
- baddox 7y agoSeems like you’d need a language-aware diff algorithm that can parse the language then diff the AST.
- thaumasiotes 7y agoI don't like the example. Unless I'm missing something, all three of these are exactly equivalent, so you could accept any of them as the result of a merge. But the problem with that idea is that two different people explicitly made a change that looks meaningless. That tells us that we're evaluating "equivalent" incorrectly, which means we don't actually have any remaining justification for picking one over another, and the conflict is hopeless without further input.
- giornogiovanna 7y agoThe correct merge, in my opinion would be D: add z w = z + w My justification is that if you put each identifier on a separate line like this: fn add( x: i32, y: i32, ) -> i32 { x + y } then as far as I know, Git would happily merge B and C into D.