-
Notifications
You must be signed in to change notification settings - Fork 122
Union merge for comments #2926
Comments
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. For example: Base:
Ours:
Theirs:
The result of a union merge (like git defines it) would be:
or
(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:
ours:
theirs:
wanted result:
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. |
@markus2330 |
Yes, better you first have a look what libgit2 supports out of the box. |
I mark this issue stale as it did not have any activity for one year. I'll close it in two weeks if no further activity occurs. If you want it to be alive again, ping the issue by writing a message here or create a new issue with the remainder of this issue. |
I closed this issue now because it has been inactive for more than one year. If I closed it by mistake, please do not hesitate to reopen it or create a new issue with the remainder of this issue. |
Originally posted by @markus2330 in #2925 (comment)
I have thought about this, too, but was not sure how we would like to have this implemented exactly.
Easy example
Assuming the files
Our
Their
Base
then line 2 is clearly a conflict case.
We could, for example, not rely on any conflict detection and plainly make a union of everything in any case or union everything in case any conflict happened.
or we could use the union only for conflict cases
More text
Two small changes alone can make quite a chaos.
Our
Their
Base
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.
Our
Their
Base
In this case just taking the our version seems useful to me.
Conclusio
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.
The text was updated successfully, but these errors were encountered: