Skip to content
Permalink
Browse files

[JENKINS-43400] Print the error to the build log rather than swallowi…

…ng it. (#9)
  • Loading branch information...
jglick authored and i386 committed Jun 6, 2017
1 parent 45c92a8 commit 398fc00bc2d4b3caab4d62dd347a43147103ed6d
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/main/java/io/jenkins/blueocean/autofavorite/FavoritingScmListener.java
@@ -70,13 +70,13 @@ public void onCheckout(Run<?, ?> build, SCM scm, FilePath workspace, TaskListene
// Sometimes the Git repository isn't consistent so we need to retry (JENKINS-39704)
GitChangeSet first;
try {
first = getChangeSet(gitSCM, workspace, lastBuiltRevision);
first = getChangeSet(gitSCM, workspace, lastBuiltRevision, listener);
} catch (GitException e) {
if (e.getCause() instanceof MissingObjectException) {
// Wait before we retry...
Thread.sleep(TimeUnit.SECONDS.toMillis(2));
try {
first = getChangeSet(gitSCM, workspace, lastBuiltRevision);
first = getChangeSet(gitSCM, workspace, lastBuiltRevision, listener);
} catch (GitException ex) {
LOGGER.log(Level.SEVERE, "Git repository is not consistent. Can't get the changeset that was just checked out.", ex);
first = null;
@@ -119,8 +119,8 @@ public void onCheckout(Run<?, ?> build, SCM scm, FilePath workspace, TaskListene
}
}

private GitChangeSet getChangeSet(GitSCM scm, FilePath workspace, Revision lastBuiltRevision) throws IOException, InterruptedException {
Git gitBuilder = Git.with(TaskListener.NULL, new EnvVars())
private GitChangeSet getChangeSet(GitSCM scm, FilePath workspace, Revision lastBuiltRevision, TaskListener listener) throws IOException, InterruptedException {
Git gitBuilder = Git.with(listener, new EnvVars())
.in(workspace);

GitTool tool = scm.resolveGitTool(new LogTaskListener(LOGGER, Level.FINE));

0 comments on commit 398fc00

Please sign in to comment.
You can’t perform that action at this time.