Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Union merge for comments #2926
I have thought about this, too, but was not sure how we would like to have this implemented exactly.
Assuming the files
then line 2 is clearly a conflict case.
or we could use the union only for conflict cases
Two small changes alone can make quite a chaos.
Then we get a conflict
With the union in conflict case only
And then assuming other stuff like typos happened in between, I can actually see some worth (not thinking about conflict markers) in a dead simple solution like simply providing all 3 versions in case any conflict happened.
Some changes but no conflicts
And then there is the case with no conflicts but a single changed version.
In this case just taking the our version seems useful to me.
At the moment I would take the changed version if no conflict happened and provide all three versions as a whole if any conflict happened. But I have not yet thought about more complicated examples yet or about what this all could mean in the context of package upgrades. Does anybody have ideas on this?
Remark: The line based merge via libgit2 might be involved at this at some point. A lot of stuff is already working locally, but as I've been (and still am a bit) sick during the last week, it is not a 100% ready.
I don't think a union merge would work for comments. The union merge in git always takes the changes from both ours and theirs. Even if both versions of a comment added a single line, adding both lines might be wrong.
The result of a union merge (like git defines it) would be:
(git says the added/changed lines may be in random order)
The union merge should always involve manual review at some point, unless we know for a fact that lines will only be added and the order doesn't matter.
I hope we can improve there with the heuristic that small edits do not need to be unioned, e.g. base:
but it would also not be a drama if it is like this:
We know that it does not matter in the case of comments: they do not have semantics for the configuration.
If the admin does not like the result, he/she can remove the line(s). This is much better than being prompted many times during the upgrades.