kohsuke/github-api — pull request #129 by mocleiri (2014-09-22 15:00:54+00:00)
Title: Allow pullRequest.getHead().getRepository().getCommit(headSha1) to work

The wrong .wrap method was used for pull requests initialized by state
(GHRepository.getPullReqests).

The wrong wrap call was introduced in 9fd34aec7fe9fa1359418c92b0a14526f837a4a4

This commit sets it back to the .wrapUp method which makes sure the pull request
substructure has the repo object set properly.

Without this change a NullPointerException is thrown on the last line of this
code because the repo object inside of the remoteRepository object is null:

GHRepository repo = github.getRepository(targetRepository);

List openPullRequests = repo.getPullRequests(GHIssueState.OPEN);

for (GHPullRequest pullRequest : openPullRequests) {

GHCommitPointer head = pullRequest.getHead();

GHRepository remoteRepository = head.getRepository();

String commitId = head.getSha();

GHCommit headCommit = remoteRepository.getCommit(commitId);