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. 14
      org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java

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

@ -142,12 +142,14 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> {
dco.setProgressMonitor(monitor);
dco.checkout();
if (!noCommit) {
newHead = new Git(getRepository()).commit()
.setMessage(srcCommit.getFullMessage())
.setReflogComment(reflogPrefix + " " //$NON-NLS-1$
+ srcCommit.getShortMessage())
.setAuthor(srcCommit.getAuthorIdent())
.setNoVerify(true).call();
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 {

Loading…
Cancel
Save