From 3623aa0c54ae9bfd0afd65386d7ec529857bd2f8 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Thu, 22 Jan 2015 00:23:13 +0100 Subject: [PATCH 1/2] Document that Git instance returned by CloneCommand needs to be closed Bug: 448570 Change-Id: Ieee334f4d82cd71ba98b26abb8667e8f64cac665 Signed-off-by: Matthias Sohn --- org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java index de24dadff..f058f799d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java @@ -114,6 +114,12 @@ public CloneCommand() { /** * Executes the {@code Clone} command. * + * The Git instance returned by this command needs to be closed by the + * caller to free resources held by the underlying {@link Repository} + * instance. It is recommended to call this method as soon as you don't need + * a reference to this {@link Git} instance and the underlying + * {@link Repository} instance anymore. + * * @return the newly created {@code Git} object with associated repository * @throws InvalidRemoteException * @throws org.eclipse.jgit.api.errors.TransportException From 83d7ea19889ef5c0aafc04a5622643822d204f35 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Thu, 22 Jan 2015 00:24:30 +0100 Subject: [PATCH 2/2] Document that repo returned by SubmoduleAddCommand needs to be closed Bug: 448570 Change-Id: I05be0a5b07f8e22f55637b9a3080362978368bcb Signed-off-by: Matthias Sohn --- .../src/org/eclipse/jgit/api/SubmoduleAddCommand.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleAddCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleAddCommand.java index 09e4cf0a1..06c8f414e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleAddCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleAddCommand.java @@ -136,6 +136,17 @@ protected boolean submoduleExists() throws IOException { return SubmoduleWalk.forIndex(repo).setFilter(filter).next(); } + /** + * Executes the {@code SubmoduleAddCommand} + * + * The {@code Repository} instance returned by this command needs to be + * closed by the caller to free resources held by the {@code Repository} + * instance. It is recommended to call this method as soon as you don't need + * a reference to this {@code Repository} instance anymore. + * + * @return the newly created {@link Repository} + * @throws GitAPIException + */ public Repository call() throws GitAPIException { checkCallable(); if (path == null || path.length() == 0)