Browse Source

CherryPickCommand: fix unclosed resource warning

Change-Id: I2dc76efd16d887048a5cb4af2b2d8e6faa4f22cd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-5.8
Matthias Sohn 5 years ago
parent
commit
7ae3507998
  1. 4
      org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java

4
org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java

@ -142,13 +142,15 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> {
dco.setProgressMonitor(monitor);
dco.checkout();
if (!noCommit) {
newHead = new Git(getRepository()).commit()
try (Git git = new Git(getRepository())) {
newHead = git.commit()
.setMessage(srcCommit.getFullMessage())
.setReflogComment(reflogPrefix + " " //$NON-NLS-1$
+ srcCommit.getShortMessage())
.setAuthor(srcCommit.getAuthorIdent())
.setNoVerify(true).call();
}
}
cherryPickedRefs.add(src);
} else {
if (merger.failed()) {

Loading…
Cancel
Save