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 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

      boolean isRepository(Path directory)
      Whether directory is (the work tree of) a Git repository.
    • open

      GitRepository open(Path directory)
      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

      GitRepository init(Path directory, String initialBranch)
      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

      GitRepository cloneRepository(String url, Path directory)
      Clones a repository, checking out the remote's default branch.
      Parameters:
      directory - target directory; it must not exist or must be empty
    • configure

      void configure(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). See GitOptions.
    • supports

      default boolean supports(Capability capability)