Schnittstelle GitRepository

Alle Superschnittstellen:
AutoCloseable
Alle bekannten Implementierungsklassen:
AbstractGitRepository, JGitRepository

public interface GitRepository extends AutoCloseable
This interface specifies the basic properties needed for the mojos to access the information about a Git repository
Autor:
Sebastian Staudt
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    void
    Checks whether the Git repository is accessible.
    void
    Closes any resources that are needed to access this repository
    Describes the current Git commit like git describe does
    Returns the abbreviated commit SHA ID of the current Git commit
    Returns the abbreviated commit SHA ID of the given Git commit
    Returns the currently checked out branch of the Git repository
    Returns the current HEAD commit of the Git repository
    Returns the Git ref used as the HEAD commit of the repository
    Returns a MailMap object that holds information from Git's .mailmap file
    Returns a map of tags available in this repository
    Returns the worktree of the repository
    boolean
    Returns whether this repository instance has been checked
    boolean
    isDirty(boolean ignoreUntracked)
    Returns whether the worktree of the repository is in a clean state
    boolean
    Returns whether this repository is currently on an “unborn” branch An “unborn” branch is a branch without any actual commits.
    void
    Load tag meta data
    void
    setHeadRef(String headRef)
    Sets the Git ref to use as the HEAD commit of the repository
    void
    Runs the given action for all commits reachable from the current HEAD commit
  • Methodendetails

    • check

      void check() throws GitRepositoryException
      Checks whether the Git repository is accessible.
      Löst aus:
      GitRepositoryException - if the repository is not accessible.
    • close

      void close()
      Closes any resources that are needed to access this repository
      Angegeben von:
      close in Schnittstelle AutoCloseable
    • describe

      Describes the current Git commit like git describe does
      Gibt zurück:
      The description of the current HEAD commit
      Löst aus:
      GitRepositoryException - if the description cannot be created
    • getAbbreviatedCommitId

      String getAbbreviatedCommitId() throws GitRepositoryException
      Returns the abbreviated commit SHA ID of the current Git commit
      Gibt zurück:
      The abbreviated commit ID of the current HEAD commit
      Löst aus:
      GitRepositoryException - if the abbreviated commit ID cannot be determined
    • getAbbreviatedCommitId

      String getAbbreviatedCommitId(GitCommit commit) throws GitRepositoryException
      Returns the abbreviated commit SHA ID of the given Git commit
      Parameter:
      commit - The Git commit to get the abbreviated ID for
      Gibt zurück:
      The abbreviated commit ID of the given commit
      Löst aus:
      GitRepositoryException - if the abbreviated commit ID cannot be determined
    • getBranch

      String getBranch() throws GitRepositoryException
      Returns the currently checked out branch of the Git repository
      Gibt zurück:
      The current branch of the Git repository
      Löst aus:
      GitRepositoryException - if the current branch cannot be determined
    • getHeadCommit

      GitCommit getHeadCommit() throws GitRepositoryException
      Returns the current HEAD commit of the Git repository
      Gibt zurück:
      The current commit of the Git Repository
      Löst aus:
      GitRepositoryException - if the current commit cannot be determined
    • getHeadRef

      String getHeadRef()
      Returns the Git ref used as the HEAD commit of the repository
      Gibt zurück:
      The ref used as HEAD
    • getMailMap

      MailMap getMailMap() throws GitRepositoryException
      Returns a MailMap object that holds information from Git's .mailmap file
      Gibt zurück:
      A .mailmap representation or null if none exits
      Löst aus:
      GitRepositoryException - if the .mailmap file cannot be read or parsed
    • getTags

      Returns a map of tags available in this repository

      The keys of the map are the SHA IDs of the objects referenced by the tags. The map's values are the tags themselves.

      Note: Only annotated tags referencing commit objects will be returned.

      Gibt zurück:
      A map of tags in this repository
      Löst aus:
      GitRepositoryException - if an error occurs while determining the tags in this repository
    • getWorkTree

      File getWorkTree()
      Returns the worktree of the repository
      Gibt zurück:
      The worktree of the repository
    • isChecked

      boolean isChecked()
      Returns whether this repository instance has been checked
      Gibt zurück:
      true if this repository has already been checked
      Siehe auch:
    • isDirty

      boolean isDirty(boolean ignoreUntracked) throws GitRepositoryException
      Returns whether the worktree of the repository is in a clean state
      Parameter:
      ignoreUntracked - If true, untracked files in the repository will be ignored
      Gibt zurück:
      true if there are modified files in the repository's worktree
      Löst aus:
      GitRepositoryException - if an error occurs while checking the worktree state
    • isOnUnbornBranch

      boolean isOnUnbornBranch() throws GitRepositoryException
      Returns whether this repository is currently on an “unborn” branch An “unborn” branch is a branch without any actual commits. This only applies when the configured head ref is actually HEAD. Otherwise a configuration error is assumed.
      Gibt zurück:
      true if the current branch is
      Löst aus:
      GitRepositoryException - if an error occurs while retrieving the current HEAD commit
    • setHeadRef

      void setHeadRef(String headRef)
      Sets the Git ref to use as the HEAD commit of the repository
      Parameter:
      headRef - The ref to use as HEAD
    • loadTag

      void loadTag(GitTag tag) throws GitRepositoryException
      Load tag meta data
      Parameter:
      tag - The tag to load information for
      Löst aus:
      GitRepositoryException - if tag metadata cannot be loaded
    • walkCommits

      void walkCommits(CommitWalkAction action) throws GitRepositoryException
      Runs the given action for all commits reachable from the current HEAD commit
      Parameter:
      action - The action to execute for each commit found
      Löst aus:
      GitRepositoryException - if an error occurs during walking through the commits