Git implementiert eine recursive 3-way merge Strategie, die solves problems with criss-crossing histories, aber welche Probleme löst diese Strategie nicht?Was sind herausragende Probleme mit dem rekursiven Three-Way Merge-Algorithmus?
Die beste Darstellung die ich bisher gefunden habe, ist auf der old revctrl wiki:
Recursive three-way merge usually provides the right answer, however there are some edge cases. For example, conflict markers can be matched incorrectly, because they aren't given any special semantic meaning for the merge algorithm, and are simply treated as lines. In particular, there are (somewhat complicated) cases where the conflict markers of two unrelated conflicts get matched against each other, even though the content sections of them are totally unrelated.
Also, recursive merge can do some of the same invalid merges as SimpleWeaveMerge does, which are described below, although exactly what it does under those circumstances is highly dependant on the details of the 3 way merge algorithm, but it isn't clear that tweaking the 3-way merge algorithm to be more conservative about showing conflicts will make such problems go away. Basically, including the conflict is creating a weave, and that introduces the problems which weaves have.
Finally, recursive three-way merge has all the inherent problems of ImplicitUndo . In particular, merging together multiple things which merge cleanly will sometimes give different answers depending on the order in which the merges happen. In fact, it's possible in a never-ending criss-cross case for a value to flip-flop until the end of time without ever getting a single unclean merge. This is a very fundamental problem, and fixing it requires first deciding what one wants to have happen in such cases, because what is appropriate behavior is unclear.
Allerdings sind diese Probleme vage angegeben. Was sind spezifische Situationen, in denen rekursive 3-Wege-Zusammenführung bricht und auf welche Weise bricht es?
Kann jemand Versionskontrollhistorien zeigen, dass es verschraubt?
(Ich bin nicht über Probleme in dem Diff-Algorithmus zu fragen, wie Verständnis Quellcode Semantik oder Konfliktlösung. Lassen Sie sich annehmen die Benutzer glücklich sind, Konflikte zu lösen und einen naiven String diff.)
In der Praxis, was ich mit 3-Wege-Fusion woanders sehen, ist, dass, wenn zwei Leute z.neuer Code zu verschiedenen Teilen einer Datei, alles ist in Ordnung, aber wenn zwei Leute entscheiden, nur ihren neuen Code an den unteren Rand der Datei zu kleben, Merge kann nicht sagen, ob Sie zwei verschiedene Anhänge an das Ende der Datei oder haben zwei konkurrierende Versuche, die gleiche Änderung zu machen, so dass es einen Konflikt wirft. Es ist also eine gute Idee, neuen Code an einem bestimmten Ort zu platzieren, nicht nur am unteren Ende der Datei. – mcdowella
@mcdowella Sie beschreiben ein Problem mit dem diff-Algorithmus, was kein Problem mit der 3-Wege-Merge-Strategie ist. Das Problem, dass zwei Personen in denselben Teil einer Datei schreiben, geschieht unabhängig davon, welche Merge-Strategie Sie verwenden. –