Class GitCommandRunner

java.lang.Object
io.github.joke.conventionalversion.git.GitCommandRunner

public class GitCommandRunner extends Object
Runs git in a directory and returns its standard output.
  • Constructor Details

    • GitCommandRunner

      public GitCommandRunner(File workingDirectory)
  • Method Details

    • run

      public String run(List<String> arguments)
      Runs a command, failing when git exits non-zero.
      Throws:
      ConventionalVersionException - when git is missing or the command fails
    • tryRun

      public Optional<String> tryRun(List<String> arguments)
      Runs a command, yielding empty when git exits non-zero rather than failing.
    • command

      @VisibleForTesting protected List<String> command(List<String> arguments)
      The full argument vector, git first. Separate from start(List) so it can be read back.
    • start

      @VisibleForTesting protected Process start(List<String> arguments)
      Spawns the command in the working directory.

      Standard error is deliberately left unmerged, which is ProcessBuilder's own default: the callers read standard output as data, and git's diagnostics must not contaminate it.