From 8c6ee92ae944ad609f5a2836198b366b39eea2de Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Mon, 26 Nov 2012 13:53:38 +0400 Subject: [PATCH] [git] Better logging in parsing the output of 'git remote show'. --- plugins/git4idea/src/git4idea/GitDeprecatedRemote.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/git4idea/src/git4idea/GitDeprecatedRemote.java b/plugins/git4idea/src/git4idea/GitDeprecatedRemote.java index 0351fd4d2390..31b22415e276 100644 --- a/plugins/git4idea/src/git4idea/GitDeprecatedRemote.java +++ b/plugins/git4idea/src/git4idea/GitDeprecatedRemote.java @@ -246,7 +246,7 @@ public final class GitDeprecatedRemote { public static GitDeprecatedRemote parseRemoteInternal(String name, String output) { StringScanner in = new StringScanner(output); if (!in.tryConsume("* ")) { - throw new IllegalStateException("Unexpected format for 'git remote show'"); + throw new IllegalStateException(unexpectedFormat(name, output)); } String nameLine = in.line(); if (!nameLine.endsWith(name)) { @@ -268,11 +268,15 @@ public final class GitDeprecatedRemote { } } else { - throw new IllegalStateException("Unexpected format for 'git remote show':\n" + output); + throw new IllegalStateException(unexpectedFormat(name, output)); } return new GitDeprecatedRemote(name, fetch, push); } + private static String unexpectedFormat(String remoteName, String output) { + return String.format("Unexpected format for 'git remote show'. Remote: %s, output:%n%s", remoteName, output); + } + /** * Get information about remote stored in locally (remote end is not queried about branches)