Record Class GitOptions

java.lang.Object
java.lang.Record
io.github.jbastgen.stemma.git.api.GitOptions
Record Components:
defaultIdentity - author and committer to use when neither the repository nor the user's git configuration names one; null for none. A configured identity always wins.
extraConfig - further git configuration (section.name → value) that is in effect for every command, with the precedence of git -c: it overrides the configuration files
network - proxy, certificate and SSH host-key handling
credentials - where stored credentials come from; null for none
askpass - a script that prints $STEMMA_GIT_USERNAME for a "Username …" prompt and $STEMMA_GIT_PASSWORD for any other; system git uses it to pass credentials without putting them on a command line. null if there is none.
sshDirectory - where the built-in Git keeps its known_hosts; null = the user's ~/.ssh

public record GitOptions(GitOptions.Identity defaultIdentity, Map<String,String> extraConfig, GitOptions.Network network, CredentialLookup credentials, Path askpass, Path sshDirectory) extends Record
Settings the application hands to a Git backend. They belong to Stemma, not to git: they are applied per command and never written to ~/.gitconfig or to a repository's .git/config (ADR 0007).
  • Constructor Details

  • Method Details

    • none

      public static GitOptions none()
      Options that change nothing: no identity, no extra configuration, default network settings.
    • credentialFor

      public Optional<CredentialLookup.Credential> credentialFor(String accountId, String url)
      The credential for a remote, if the application has one.
    • isValidKey

      public static boolean isValidKey(String key)
      Whether key looks like section.name or section.subsection.name.
    • effectiveConfig

      public Map<String,String> effectiveConfig()
      Everything that is in effect as git configuration: the extra configuration plus what the network settings mean as configuration (http.proxy, http.sslVerify, http.sslCAInfo). The network settings win.
    • environment

      public GitOptions.EnvChange environment()
      What to change in the environment of a git process: proxy variables and, if wanted, the SSH command.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • defaultIdentity

      public GitOptions.Identity defaultIdentity()
      Returns the value of the defaultIdentity record component.
      Returns:
      the value of the defaultIdentity record component
    • extraConfig

      public Map<String,String> extraConfig()
      Returns the value of the extraConfig record component.
      Returns:
      the value of the extraConfig record component
    • network

      public GitOptions.Network network()
      Returns the value of the network record component.
      Returns:
      the value of the network record component
    • credentials

      public CredentialLookup credentials()
      Returns the value of the credentials record component.
      Returns:
      the value of the credentials record component
    • askpass

      public Path askpass()
      Returns the value of the askpass record component.
      Returns:
      the value of the askpass record component
    • sshDirectory

      public Path sshDirectory()
      Returns the value of the sshDirectory record component.
      Returns:
      the value of the sshDirectory record component