IDEA-55352 See file content in modify-delete or delete-modify conflict.
authorKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Sun, 20 Mar 2011 11:09:08 +0000 (14:09 +0300)
committerKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Sun, 20 Mar 2011 11:09:08 +0000 (14:09 +0300)
plugins/git4idea/src/git4idea/commands/GitFileUtils.java
plugins/git4idea/src/git4idea/merge/GitMergeProvider.java

index af46bd08a620ade56df29b8e894e67e039fd6323..88711b9af5f88e7e5262148cd07d3536b5e3ad49 100644 (file)
@@ -236,7 +236,9 @@ public class GitFileUtils {
     }
     catch (VcsException e) {
       String m = e.getMessage().trim();
-      if (m.startsWith("fatal: ambiguous argument ") || (m.startsWith("fatal: Path '") && m.contains("' exists on disk, but not in '"))) {
+      if (m.startsWith("fatal: ambiguous argument ")
+          || (m.startsWith("fatal: Path '") && m.contains("' exists on disk, but not in '"))
+          || (m.contains("is in the index, but not at stage "))) {
         result = null;
       }
       else {
index 94235accf7c6968d9a0e750de5d6b1124b17fd94..e380823b936bf6a987e0a33716f0219e8a7ccf16 100644 (file)
@@ -198,7 +198,7 @@ public class GitMergeProvider implements MergeProvider2 {
      * @return true if the merge operation can be applied
      */
     boolean isMergeable() {
-      return myStatusTheirs == Conflict.Status.MODIFIED && myStatusYours == Conflict.Status.MODIFIED;
+      return true;
     }
 
     /**
@@ -290,54 +290,42 @@ public class GitMergeProvider implements MergeProvider2 {
       }
     }
 
-    /**
-     * {@inheritDoc}
-     */
     public ColumnInfo[] getMergeInfoColumns() {
       return new ColumnInfo[]{new StatusColumn(false), new StatusColumn(true)};
     }
 
-    /**
-     * {@inheritDoc}
-     */
     public boolean canMerge(VirtualFile file) {
       Conflict c = myConflicts.get(file);
-      return c != null && c.isMergeable();
+      return c != null;
     }
 
-    /**
-     * {@inheritDoc}
-     */
     public void conflictResolvedForFile(VirtualFile file, Resolution resolution) {
       Conflict c = myConflicts.get(file);
       assert c != null : "Conflict was not loaded for the file: " + file.getPath();
       try {
-        if (c.isMergeable()) {
-          GitFileUtils.addFiles(myProject, c.myRoot, file);
+        Conflict.Status status;
+        switch (resolution) {
+          case AcceptedTheirs:
+            status = c.myStatusTheirs;
+            break;
+          case AcceptedYours:
+            status = c.myStatusYours;
+            break;
+          case Merged:
+            status = Conflict.Status.MODIFIED;
+            break;
+          default:
+            throw new IllegalArgumentException("Unsupported resolution for unmergable files(" + file.getPath() + "): " + resolution);
         }
-        else {
-          Conflict.Status status;
-          switch (resolution) {
-            case AcceptedTheirs:
-              status = c.myStatusTheirs;
-              break;
-            case AcceptedYours:
-              status = c.myStatusYours;
-              break;
-            case Merged:
-            default:
-              throw new IllegalArgumentException("Unsupported resolution for unmergable files(" + file.getPath() + "): " + resolution);
-          }
-          switch (status) {
-            case MODIFIED:
-              GitFileUtils.addFiles(myProject, c.myRoot, file);
-              break;
-            case DELETED:
-              GitFileUtils.deleteFiles(myProject, c.myRoot, file);
-              break;
-            default:
-              throw new IllegalArgumentException("Unsupported status(" + file.getPath() + "): " + status);
-          }
+        switch (status) {
+          case MODIFIED:
+            GitFileUtils.addFiles(myProject, c.myRoot, file);
+            break;
+          case DELETED:
+            GitFileUtils.deleteFiles(myProject, c.myRoot, file);
+            break;
+          default:
+            throw new IllegalArgumentException("Unsupported status(" + file.getPath() + "): " + status);
         }
       }
       catch (VcsException e) {