Include repository dir in fetch error message
authorDmitry Neverov <dmitry.neverov@gmail.com>
Thu, 27 Jul 2017 10:36:00 +0000 (12:36 +0200)
committerDmitry Neverov <dmitry.neverov@gmail.com>
Thu, 27 Jul 2017 10:36:00 +0000 (12:36 +0200)
git-common/src/jetbrains/buildServer/buildTriggers/vcs/git/CommandLineUtil.java
git-server/src/jetbrains/buildServer/buildTriggers/vcs/git/FetchCommandImpl.java

index c4b1afa96ccc0aa1aacd659f4f6910a64b0fcc2f..cb909cd46adc62eecd82a5d37a01fac3ad4ac800 100644 (file)
@@ -38,13 +38,18 @@ public final class CommandLineUtil {
 
   @Nullable
   public static VcsException getCommandLineError(@NotNull String cmdName, @NotNull ExecResult res, boolean includeStdOut, boolean includeStdErr) {
+    return getCommandLineError(cmdName, "", res, includeStdOut, includeStdErr);
+  }
+
+  @Nullable
+  public static VcsException getCommandLineError(@NotNull String cmdName, @NotNull String details, @NotNull ExecResult res, boolean includeStdOut, boolean includeStdErr) {
     //noinspection ThrowableResultOfMethodCallIgnored
     Throwable exception = res.getException();
     int exitCode = res.getExitCode();
     if (exitCode != 0 || exception != null) {
       String stderr = res.getStderr();
       String stdout = res.getStdout();
-      final String message = "'" + cmdName + "' command failed." +
+      final String message = "'" + cmdName + "' command failed" + details + "." +
                              (exception != null ? "\nexception: " + exception.getMessage() : "") +
                              (includeStdErr && !StringUtil.isEmpty(stderr) ? "\nstderr: " + stderr.trim() : "") +
                              (includeStdOut && !StringUtil.isEmpty(stdout) ? "\nstdout: " + stdout.trim() : "") +
index 8cc2daa0a05948faeff13e159fe07ffb17af22d1..9bfcf34a13cf1a2f0cfefb0602c2d9f4f95f896a 100644 (file)
@@ -170,7 +170,9 @@ public class FetchCommandImpl implements FetchCommand {
       if (PERFORMANCE_LOG.isDebugEnabled())
         PERFORMANCE_LOG.debug("[fetch in separate process] root=" + debugInfo + ", took " + (System.currentTimeMillis() - fetchStart) + "ms");
 
-      VcsException commandError = CommandLineUtil.getCommandLineError("git fetch", result);
+      VcsException commandError = CommandLineUtil.getCommandLineError("git fetch",
+                                                                      " (repository dir: <TeamCity data dir>/system/caches/git/" + repository.getDirectory().getName() + ")",
+                                                                      result, true, true);
       if (commandError != null) {
         if (isOutOfMemoryError(result))
           LOG.warn("There is not enough memory for git fetch, teamcity.git.fetch.process.max.memory=" + myConfig.getFetchProcessMaxMemory() + ", try to increase it.");