forked from magnayn/Hudson-GIT-plugin
Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #497 from vgaidarji/vgaidarji/improve-logs-output
[JENKINS-38241] Print commit message to log on checkout
- Loading branch information
Showing
6 changed files
with
70 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,28 @@ | ||
package hudson.plugins.git.util; | ||
|
||
import hudson.remoting.VirtualChannel; | ||
import java.io.IOException; | ||
import org.eclipse.jgit.lib.Repository; | ||
import org.eclipse.jgit.revwalk.RevCommit; | ||
import org.eclipse.jgit.revwalk.RevWalk; | ||
import org.jenkinsci.plugins.gitclient.RepositoryCallback; | ||
|
||
/** | ||
* Retrieves {@link RevCommit} from given {@link Build} revision. | ||
*/ | ||
public final class RevCommitRepositoryCallback implements RepositoryCallback<RevCommit> { | ||
private static final long serialVersionUID = 1L; | ||
private final Build revToBuild; | ||
|
||
public RevCommitRepositoryCallback(Build revToBuild) { | ||
this.revToBuild = revToBuild; | ||
} | ||
|
||
@Override | ||
public RevCommit invoke(Repository repository, VirtualChannel virtualChannel) | ||
throws IOException, InterruptedException { | ||
try (RevWalk walk = new RevWalk(repository)) { | ||
return walk.parseCommit(revToBuild.revision.getSha1()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters