Document SimpleGitWorkingCopyFactory

This commit is contained in:
René Pfeuffer
2020-05-10 17:03:01 +02:00
parent f74b7626eb
commit 62a47d016f
14 changed files with 226 additions and 58 deletions

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -39,12 +39,13 @@ import sonia.scm.repository.Repository;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.util.function.Supplier;
/**
*
* @author Sebastian Sdorra
*/
public class GitContext implements Closeable
public class GitContext implements Closeable, Supplier<Repository>
{
/**
@@ -108,6 +109,11 @@ public class GitContext implements Closeable
return repository;
}
@Override
public Repository get() {
return getRepository();
}
File getDirectory() {
return directory;
}

View File

@@ -133,14 +133,9 @@ public class SimpleGitWorkingCopyFactory extends SimpleWorkingCopyFactory<Reposi
}
@Override
protected void closeWorkingCopyInternal(Repository workingCopy) throws Exception {
protected void closeWorkingCopy(Repository workingCopy) throws Exception {
if (workingCopy != null) {
workingCopy.close();
}
}
@Override
protected sonia.scm.repository.Repository getScmRepository(GitContext context) {
return context.getRepository();
}
}