From b2f9ce2f8410efbfe171b88a7a74b1f07d90efb9 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Tue, 20 Oct 2015 20:01:40 +0300 Subject: [PATCH] [git] IDEA-71600 better identify conflict during unstash --- .../commands/GitSimpleEventDetector.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/plugins/git4idea/src/git4idea/commands/GitSimpleEventDetector.java b/plugins/git4idea/src/git4idea/commands/GitSimpleEventDetector.java index 7fd7d04ce59d..8a91f5e34247 100644 --- a/plugins/git4idea/src/git4idea/commands/GitSimpleEventDetector.java +++ b/plugins/git4idea/src/git4idea/commands/GitSimpleEventDetector.java @@ -16,39 +16,41 @@ package git4idea.commands; import com.intellij.openapi.util.Key; +import com.intellij.openapi.util.text.StringUtil; +import org.jetbrains.annotations.NotNull; /** * @author Kirill Likhodedov */ public class GitSimpleEventDetector implements GitLineHandlerListener { - private final Event myEvent; + @NotNull private final Event myEvent; private boolean myHappened; public enum Event { - CHERRY_PICK_CONFLICT("fter resolving the conflicts"), // a is uppercase in 1.7.0.5 and lowercase in 1.7.9.2 + CHERRY_PICK_CONFLICT("after resolving the conflicts"), LOCAL_CHANGES_OVERWRITTEN_BY_CHERRY_PICK("would be overwritten by merge"), UNMERGED_PREVENTING_CHECKOUT("you need to resolve your current index first"), UNMERGED_PREVENTING_MERGE("is not possible because you have unmerged files"), BRANCH_NOT_FULLY_MERGED("is not fully merged"), MERGE_CONFLICT("Automatic merge failed; fix conflicts and then commit the result"), - MERGE_CONFLICT_ON_UNSTASH("Merge conflict"), + MERGE_CONFLICT_ON_UNSTASH("conflict"), ALREADY_UP_TO_DATE("Already up-to-date"); private final String myDetectionString; - private Event(String detectionString) { + Event(@NotNull String detectionString) { myDetectionString = detectionString; } } - public GitSimpleEventDetector(Event event) { + public GitSimpleEventDetector(@NotNull Event event) { myEvent = event; } @Override - public void onLineAvailable(String line, Key outputType) { - if (line.contains(myEvent.myDetectionString)) { + public void onLineAvailable(@NotNull String line, Key outputType) { + if (StringUtil.containsIgnoreCase(line, myEvent.myDetectionString)) { myHappened = true; } }