aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm/src
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit.pgm/src')
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/UploadPack.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/UploadPack.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/UploadPack.java
index 36103f2e6f..ac51643b6e 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/UploadPack.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/UploadPack.java
@@ -42,12 +42,13 @@ class UploadPack extends TextBuiltin {
try {
FileKey key = FileKey.lenient(srcGitdir, FS.DETECTED);
db = key.open(true /* must exist */);
- org.eclipse.jgit.transport.UploadPack up = new org.eclipse.jgit.transport.UploadPack(
- db);
- if (0 <= timeout) {
- up.setTimeout(timeout);
+ try (org.eclipse.jgit.transport.UploadPack up = new org.eclipse.jgit.transport.UploadPack(
+ db)) {
+ if (0 <= timeout) {
+ up.setTimeout(timeout);
+ }
+ up.upload(ins, outs, errs);
}
- up.upload(ins, outs, errs);
} catch (RepositoryNotFoundException notFound) {
throw die(MessageFormat.format(CLIText.get().notAGitRepository,
srcGitdir.getPath()), notFound);