| Summary: | Merge "using strategy resolve resulted in: Failed." Pulls with conflicts also fail. | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Technology] JGit | Reporter: | Braids Constance <eclipse.org-braids> | ||||||||
| Component: | JGit | Assignee: | Robin Stocker <robin> | ||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||
| Severity: | normal | ||||||||||
| Priority: | P3 | CC: | adietish, anton.kukushkin, catapl3xis, eclipse.org-braids, flood, hedefalk, jiri.dudek, jkwuc89, lbourgault_roy, maximilianmeier42, mooseroy, oman002, remy.suen, robin, stepper | ||||||||
| Version: | 2.0 | ||||||||||
| Target Milestone: | 2.1-M1 | ||||||||||
| Hardware: | PC | ||||||||||
| OS: | Windows XP | ||||||||||
| URL: | http://www.eclipse.org/forums/index.php/mv/msg/231804/711151/#msg_711151 | ||||||||||
| Whiteboard: | |||||||||||
| Attachments: |
|
||||||||||
|
Description
Braids Constance
Step 1 should read, "Modify and Commit a file..." We've got the same issue (1.1.0.201109151100-r) - conflict markers show up, - but repo-state is _not_ MERGING - "Merge Tool" is unavailable. Seems only to affect files in the project root. Steps to reproduce (tested version was egit-1.2.0.201111090740): 1. Clone http://egit.eclipse.org/r/p/egit-training.git 2. Create new branch "bug354099" at 51101ae160c68450deadc0acd0e662649e775541 3. Edit org.eclipse.example.calc/build.properties, eg. swap "tst" ans "src" 4. Merge with origin/master (In reply to comment #4) > Steps to reproduce (tested version was egit-1.2.0.201111090740): > 1. Clone http://egit.eclipse.org/r/p/egit-training.git > 2. Create new branch "bug354099" at 51101ae160c68450deadc0acd0e662649e775541 > 3. Edit org.eclipse.example.calc/build.properties, eg. swap "tst" ans "src" > 4. Merge with origin/master Tried this with todays nightly build (2011-11-25) and the merge went through without conflicts. Maybe when you tried the repository was different ? We forcefully reset the training repository each time before we run another training. Can you provide a sample repository and step by step instructions reproducing the problem for the sample repository ? Created attachment 207700 [details]
Repo demonstrating 354099
To reproduce simply choose merge on master in history view.
I can reproduce the bug using the steps provided by Jan. 1. Clone http://egit.eclipse.org/egit-training.git 2. Create new branch "bug354099" at 51101ae160c68450deadc0acd0e662649e775541 3. Edit org.eclipse.example.calc/build.properties; swap "tst" and "src" (Commited the changes <- this step was not mentioned by Jan, but was - I think - implied) 4. Merge with master via EGit fails with !ENTRY org.eclipse.egit.ui 4 0 2012-01-10 12:58:27.635 !MESSAGE Merge of revisions 67a8d116c31aae5f4396c1a6a356fcce80c99cf8, 9c78d21c64ff5f66c122fbef43427f3e44b71447 with base 51101ae160c68450deadc0acd0e662649e775541 using strategy resolve resulted in: Failed. now the repository is in no special state (no |Conflicts or any other markers on the repository name). however the git workspace looks like you would expect it to when in state |Conflicts; conflicting files do have the ">>> HEAD === <<< theirs" conflict markers and all incoming changes are listed under "Staged changes" in "Git staging" view. if you go on and resolve the conflicts, add the conflicting files to the index and do a commit a *regular* commit is being done, not a merge commit. If we repeat the above steps, but instead of using EGit, we use msysgit to merge this is the output: Alle@MAX /E/gittraining/egit-training (bug354099) $ git merge master Auto-merging org.eclipse.example.calc/src/org/eclipse/example/calc/internal/ui/swing/CalculatorUI.java Auto-merging org.eclipse.example.calc/build.properties CONFLICT (content): Merge conflict in org.eclipse.example.calc/build.properties Auto-merging org.eclipse.example.calc/SwingCalculatorUI.launch Auto-merging org.eclipse.example.calc.test/tst/org/eclipse/example/calc/internal/operations/SquareTest.java Auto-merging org.eclipse.example.calc.test/tst/org/eclipse/example/calc/OperationsTest.java Auto-merging org.eclipse.example.calc.test/org.eclipse.example.calc--All-Tests.launch Automatic merge failed; fix conflicts and then commit the result. Alle@MAX /E/gittraining/egit-training (bug354099|MERGING) now the repository is in the MERGE_CONFLICTS state, which is the expected/OK state. Now you can go back to eclipse. Egit will correctly see that the repository has merge conflicts. You can resolve the conflicts, add the files to the index and commit. The commit will then be a *merge* commit as it is supposed to be. From a top-down view it seems the only thing EGit fails to do is to put the repository the MERGE_CONFLICTS state and return a "Conflicting" merge result instead of the "Failed" one. Environment used: eclipse.buildId=M20110909-1335 java.version=1.6.0_29 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE Command-line arguments: -os win32 -ws win32 -arch x86 -data E:\zzzWorkspace EGit (these versions were tested) Stable release: org.eclipse.jgit (1.2.0.201112221803-r) "JGit Core" org.eclipse.egit (1.2.0.201112221803-r) "Git Team Provider" Nightly build: org.eclipse.jgit (1.3.0.201201090718) "JGit Core" org.eclipse.egit (1.3.0.201201090723) "Git Team Provider" msysgit various versions tested, including "1.7.4.msysgit.0"; all worked the same) Created attachment 209364 [details]
output of log method
I've been able to track the problem down to class org.eclipse.jgit.merge.ResolveMerger.
During the checkout JGit tries to delete non-empty folders which of course fails.
I changed method checkout to: (version is 1.3.0.201201101327)
private void checkout() throws NoWorkTreeException, IOException {
ObjectReader r = db.getObjectDatabase().newReader();
try {
for (Map.Entry<String, DirCacheEntry> entry : toBeCheckedOut.entrySet()) {
+ log("toBeCheckedOut: " + entry.getKey() + "=" + entry.getValue());
File f = new File(db.getWorkTree(), entry.getKey());
if (entry.getValue() != null) {
createDir(f.getParentFile());
DirCacheCheckout.checkoutEntry(db, f, entry.getValue(), r);
} else {
+ if (f.isDirectory()) {
+ log("Would delete folder " + f);
+ } else if (!f.delete()) {
- if (!f.delete()) {
+ log("delete failed for " + f);
failingPaths.put(entry.getKey(),
MergeFailureReason.COULD_NOT_DELETE);
}
}
modifiedFiles.add(entry.getKey());
}
} finally {
r.release();
}
}
The output of the log statements are in the attachment 209364 [details].
With my modification (not deleting any folder)
EGit correctly reports the merge result CONFLICT instead of FAILED.
However, someone from the JGit/EGit team must check what's the real intention
of the f.delete() statement and consider the case when f is a folder.
If folders are to be deleted, the proper sequence (child before parent) must be chosen.
If folders are not to be deleted, something else is wrong which requires further analysis.
Created attachment 213103 [details]
Commit error
I just had "untracked" & "ignored" one file.
Got "red cross" failure mesage, see attched image.
Had to delete file manualy from file system, then copy it again.
I think this issue is related to the bug of this topic, maybe it's related to addtion/deletion of files in repository.
I ran into this same issue this morning when attempting to pull in changes from my Github repo into my local repo via EGit inside Eclipse. The changes in the remote repo included a new directory named bin that contained several files and directories. Inside my local repo, the bin directory is ignored because it is listed inside ~/gitignore_global. Inside Eclipse, I removed the bin directory from my project. Then, I attempted to do the pull again and this time, the pull from the remote repository properly displayed the result, "Merged". Based on this, it appears that this bug may being caused by new files in the remote repository. We're considering using eclipse together with git for our code base, and while testing out egit, bumped into this on our windows machines (two of them so far). I can also confirm this bug where I work, on both a Mac OS X and a Windows 7 machine. In the meantime, if you want a quick fix : When the "Failed" message appear, immediately do a hard reset of your workspace. Then redo the merge from a command-line. Go back to eclipse, and refresh. The workspace will correctly be in Conflicted mode, and the merge tool will be available. Not pretty, but it mostly work. I can confirm that this is a bug in JGit -> changed the product to JGit. The analysis in comment 9 is correct, pushed changes to fix this: https://git.eclipse.org/r/6326 https://git.eclipse.org/r/6327 The fixes are now in master: 028434e4f58bfc154da2f56a68e7aefc220bb359 e623db0f876d95c9faae7ca089cb11c0bc2e6a7c Please wait for the next nightly build to verify: http://download.eclipse.org/egit/updates-nightly |