Skip to content

Commit

Permalink
[JENKINS-43400] Print the error to the build log rather than swallowi…
Browse files Browse the repository at this point in the history
…ng it. (#9)
  • Loading branch information
jglick authored and James William Dumay committed Jun 6, 2017
1 parent 45c92a8 commit 398fc00
Showing 1 changed file with 4 additions and 4 deletions.
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 398fc00

Please sign in to comment.