From 41710e600dd32f2b8cf6d207e7655a0c9e2f7e29 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Wed, 31 Jul 2019 12:18:13 +0300 Subject: [PATCH] git: cleanup: remove useless code The most low-level parseChanges() method parses while(sc.hasMoreData()), so there is no chance that it exists before parsing everything (apart of throwing an exception). GitOrigin-RevId: 3ff8da24ddb7d83d98204d7f327b15a403b3055f --- .../src/git4idea/changes/GitChangeUtils.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/plugins/git4idea/src/git4idea/changes/GitChangeUtils.java b/plugins/git4idea/src/git4idea/changes/GitChangeUtils.java index 48492a2a9a96..d8db9e1547ca 100644 --- a/plugins/git4idea/src/git4idea/changes/GitChangeUtils.java +++ b/plugins/git4idea/src/git4idea/changes/GitChangeUtils.java @@ -60,11 +60,7 @@ public class GitChangeUtils { GitRevisionNumber parentRevision, String s, Collection changes) throws VcsException { - StringScanner sc = new StringScanner(s); - parseChanges(project, vcsRoot, thisRevision, parentRevision, sc, changes); - if (sc.hasMoreData()) { - throw new IllegalStateException("Unknown file status: " + sc.line()); - } + parseChanges(project, vcsRoot, thisRevision, parentRevision, new StringScanner(s), changes); } /** @@ -391,14 +387,10 @@ public class GitChangeUtils { }); String output = Git.getInstance().runCommand(handler).getOutputOrThrow(); - StringScanner sc = new StringScanner(output); Collection changes = new ArrayList<>(); - parseChanges(root, sc, (status, beforePath, afterPath) -> { + parseChanges(root, new StringScanner(output), (status, beforePath, afterPath) -> { changes.add(new GitDiffChange(status, beforePath, afterPath)); }); - if (sc.hasMoreData()) { - throw new IllegalStateException("Unknown file status: " + sc.line()); - } return changes; }