Skip to content

Commit

Permalink
Merge pull request #530 from MarkEWaite/remove-printCommitMessageToLog
Browse files Browse the repository at this point in the history
[JENKINS-45729] - Move print commit message after checkout
  • Loading branch information
MarkEWaite committed Sep 29, 2017
2 parents a6ddae8 + c1ac701 commit 34f047f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main/java/hudson/plugins/git/GitSCM.java
Expand Up @@ -1156,8 +1156,6 @@ public void checkout(Run<?, ?> build, Launcher launcher, FilePath workspace, Tas

listener.getLogger().println("Checking out " + revToBuild.revision);

printCommitMessageToLog(listener, git, revToBuild);

CheckoutCommand checkoutCommand = git.checkout().branch(localBranchName).ref(revToBuild.revision.getSha1String()).deleteBranchIfExist(true);
for (GitSCMExtension ext : this.getExtensions()) {
ext.decorateCheckoutCommand(this, build, git, listener, checkoutCommand);
Expand All @@ -1170,6 +1168,13 @@ public void checkout(Run<?, ?> build, Launcher launcher, FilePath workspace, Tas
throw new IOException("Could not checkout " + revToBuild.revision.getSha1String(), e);
}

// Needs to be after the checkout so that revToBuild is in the workspace
try {
printCommitMessageToLog(listener, git, revToBuild);
} catch (GitException ge) {
listener.getLogger().println("Exception logging commit message for " + revToBuild + ": " + ge.getMessage());
}

// Don't add the tag and changelog if we've already processed this BuildData before.
if (!buildDataAlreadyPresent) {
if (build.getActions(AbstractScmTagAction.class).isEmpty()) {
Expand Down

0 comments on commit 34f047f

Please sign in to comment.