Class GitDiscovery

java.lang.Object
io.github.jbastgen.stemma.git.cli.GitDiscovery

public final class GitDiscovery extends Object
Finds and validates git installations: on the PATH, in well-known locations per operating system, and at a location chosen by the user (an installation directory or the executable itself).
  • Constructor Details

    • GitDiscovery

      public GitDiscovery()
      Looks at the real system: its operating system, environment and home folder.
  • Method Details

    • discover

      public List<GitInstallation> discover()
      All usable git installations found on this machine, in order of preference: PATH entries first, then well-known locations. The same executable (also via symlink) is listed once.
    • findBest

      public Optional<GitInstallation> findBest()
      The preferred installation: the first supported one, or empty if there is none.
    • resolve

      public Optional<GitInstallation> resolve(Path location, String origin)
      Resolves a location chosen by the user: either the git executable or an installation directory. For a directory the usual layouts are tried (cmd/git.exe and bin/git.exe of Git for Windows, bin/git of Unix installations, or the executable directly inside the directory).
    • probe

      public Optional<GitInstallation> probe(Path executable, String origin)
      Runs git --version on one executable and validates the answer.