Interface GitBackend
public interface GitBackend
Service provider interface implemented by every way of talking to Git (built-in JGit, system git CLI, ...).
Implementations are discovered with
ServiceLoader.-
Method Summary
Modifier and TypeMethodDescriptionThe optional features this backend supports.cloneRepository(String url, Path directory) Clones a repository, checking out the remote's default branch.voidconfigure(GitOptions options) Hands the application's settings to the backend; they apply to every repository opened afterwards and to operations that need no repository (clone).Human readable name for the UI.id()Stable identifier, e.g.Creates a new repository.booleanisRepository(Path directory) Whetherdirectoryis (the work tree of) a Git repository.Opens an existing repository.default booleansupports(Capability capability)
-
Method Details
-
id
String id()Stable identifier, e.g."jgit"or"cli". Used in settings. -
displayName
String displayName()Human readable name for the UI. -
capabilities
Set<Capability> capabilities()The optional features this backend supports. -
isRepository
Whetherdirectoryis (the work tree of) a Git repository. -
open
Opens an existing repository.- Parameters:
directory- the work tree directory (or a sub directory of it)- Throws:
GitException- if the directory is not a repository or cannot be read
-
init
Creates a new repository.- Parameters:
initialBranch- name of the first branch, e.g.main- Throws:
GitException- if there already is a repository or the directory cannot be created
-
cloneRepository
Clones a repository, checking out the remote's default branch.- Parameters:
directory- target directory; it must not exist or must be empty
-
configure
Hands the application's settings to the backend; they apply to every repository opened afterwards and to operations that need no repository (clone). SeeGitOptions. -
supports
-