When using a tool such as git to merge two files, a conflict could be detected and added to the result of the merge.
A merge of these two files:
my file:
Common line of code 1
Common line of code 2
my lines
Common line of code 3
Common line of code 4
their file:
Common line of code 1
Common line of code 2
their lines
Common line of code 3
Common line of code 4
would result in:
Common line of code 1
Common line of code 2
<<<<<<< Mine
my lines
=======
their lines
>>>>>>> Theirs
Common line of code 3
Common line of code 4
Resolving this conflict with Mine would create this file:
Common line of code 1
Common line of code 2
my lines
Common line of code 3
Common line of code 4
Resolving this conflict with Theirs would create this file:
Common line of code 1
Common line of code 2
their lines
Common line of code 3
Common line of code 4
The objective of this challenge is to write a source file that contains a conflict and still compiles/executes.
Write a source file which:
- contains one valid, two-way, conflict marked by the proper patch conflict markers (
<<<<<<<
,=======
,>>>>>>>
) Mine and Theirs file descriptors after the markers are optional. - compiles/executes without errors/warnings if the markers remain a part of the source
- compiles/executes without errors/warnings if the conflict is resolved by using mine
- compiles/executes without errors/warnings if the conflict is resolved by using theirs
- outputs "Hello Conflict" when compiling/executing the conflicted file
- outputs "Hello Mine" when compiling/executing the mine version
- outputs "Hello Theirs" when compiling/executing the theirs version
The markers should be located in the source file in such a way that kdiff3 recognizes the conflict.
Standard loopholes are forbidden.
The shortest code wins.
Score is the length of the conflicted source