-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect Handling of Insertion / Deletion Conflicts between Files #12
Comments
Thx for reporting! That doesn't sound right indeed. I'll look into this and try to reproduce it. I'll get back to you. |
@ttben One question w.r.t. the renaming, just to make sure I'm on the same page here: In the right branch, did you rename the whole file (i.e., C.java -> D.java), or just the class (i.e., still C.java, but with content of class D)? |
I renamed both the file itself and the name of the class |
We are on it right now. It's one of those things that we know about but don't run into often enough to fix. Now we have a reason ;) |
Oh ok :) Thanks! |
What files would you expect as a result of the merge (C.java and D.java or D.java with both methods)? According to 3 way merge rules this situation is an insertion-deletion conflict. This is tricky to represent on the file level. What we 'do' now (really it's an oversight in our merge routine) is incorrect though. |
Actually, the insertion-deletion conflict should not occur IMO, since methods are unordered in Java. I also tried to generate the diff only, to answer this very specific question, but executing JDime with the |
Actually I would be interested that JDime states that a insertion-deletion conflict occured, and present me the diffs between base/left and base/right ; like a classical git-merge, |
First of all, the However, we don't get down to the AST level in this case since the C.java and D.java files are never connected by the matchers. If we were to merge their ASTs, the order of methods would not matter, that is correct. What JDime sees (before it gets to ASTs) is a tree of files and on this level the matchings imply that C was deleted and D was added. We fail to notice that C has also changed (this bug is specific to recursive merging of directories).
Exactly, the only feasible solution right now is to produce a file tree containing a conflict that involves C.java and notify the user. |
Thanks for your answer and on the clarifications about Thank you again for your clarification between the identified bug and the expected behavior.
|
For demonstration purposes, one of the best ways to show the advantages of structured merging is to reorder methods. Git will fail spectacularly in this case while JDime can merge the methods. Renaming is not fully supported by JDime at the moment. Structured merging will give you both methods by default. For git it depends on the context of the changed lines. We have ways of matching, e.g., renamed method declaration nodes (that contain the name of the method) if all their children are matched. This is one of the situations that the merger cannot handle currently. You can experiment with the |
Thank you for your answer. I am not quite sure how to experiment what you propose.
Then,
should yield the diffs that exist? Because when I am running it, it returns nothing.. Thanks again for your quick answers! |
In this case merging works without lookahead ( As for |
Ok thank you for all your answers! |
Signed-off-by: Olaf Lessenich <lessenic@fim.uni-passau.de>
…using a hash of the content as their hashID See GitHub issue se-sic#12 Signed-off-by: Olaf Lessenich <lessenic@fim.uni-passau.de>
Insertion/Deletion conflicts should be fixed in master 61d7dc1 (v0.4.3.2) and develop 87c83bb. |
Hello!
I am trying to perform a 3-way merge with JDime to show it to my students (and show what Git would have done), and I can't make it work as expected.
The context is easy and is the following:
Class C
with only one dummy method.Class C
intoClass D
Class C
(since it exists in her branch)After building JDime, I run the following:
./JDime -m linebased -p -r ~/Desktop/test/left/ ~/Desktop/test/base/ ~/Desktop/test/right/
(by the way, the option
unstructured
is specified in thereadme
but does not exist)I expected
C
and full addition ofD
by the right branch,C
by the left branchInstead, the merge result is:
I tried to run this command:
./JDime -m structured -p -r ~/Desktop/test/left/ ~/Desktop/test/base/ ~/Desktop/test/right/
and I have exactly the same result as before.
Am I doing something wrong here?
Thanks!
The text was updated successfully, but these errors were encountered: