Skip to content

Commit

Permalink
Fix resource leak
Browse files Browse the repository at this point in the history
  • Loading branch information
JornVernee committed Aug 30, 2019
1 parent 2099a07 commit 62d1e15
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,12 @@ private void mergeIfAhead(Repository repo, Branch branch, Branch parent) throws
} else {
log.info("Fast forwarded " + branch + " to " + parent);
}
log.info("merge with " + parent + " succeeded. The following commits will be pushed:\n"
+ repo.commits("origin/" + branch.name() + ".." + branch.name()).stream()
.map(Commit::toString)
.collect(Collectors.joining("\n", "\n", "\n")));
try (var commits = repo.commits("origin/" + branch.name() + ".." + branch.name()).stream()) {
log.info("merge with " + parent + " succeeded. The following commits will be pushed:\n"
+ commits
.map(Commit::toString)
.collect(Collectors.joining("\n", "\n", "\n")));
}
try {
repo.push(repo.head(), hostedRepo.getUrl(), branch.name());
} catch (IOException e) {
Expand Down

0 comments on commit 62d1e15

Please sign in to comment.