Package atessera.sensei.git
Class GitRepository
java.lang.Object
atessera.sensei.git.GitRepository
- All Implemented Interfaces:
Closeable,AutoCloseable
A local clone of a student git repository.
Instances are meant to be used inside a try-with-resources block so the cloned directory is recursively removed when the check finishes.
-
Constructor Summary
ConstructorsConstructorDescriptionGitRepository(String url, String branch, Path workDir) Clones a repository into a fresh temporary directory. -
Method Summary
-
Constructor Details
-
GitRepository
Clones a repository into a fresh temporary directory.- Parameters:
url- repository URLbranch- optional branch name;nullor blank means the default branchworkDir- parent directory for the clone- Throws:
IOException- when the clone cannot be created
-
-
Method Details
-
path
Returns the root directory of the clone.- Returns:
- clone root directory
-
close
public void close()Recursively removes the clone directory.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-