Schnittstelle GitRepository
- Alle Superschnittstellen:
AutoCloseable
- Alle bekannten Implementierungsklassen:
AbstractGitRepository
,JGitRepository
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 TypMethodeBeschreibungvoid
check()
Checks whether the Git repository is accessible.void
close()
Closes any resources that are needed to access this repositorydescribe()
Describes the current Git commit likegit describe
doesReturns the abbreviated commit SHA ID of the current Git commitgetAbbreviatedCommitId
(GitCommit commit) Returns the abbreviated commit SHA ID of the given Git commitReturns the currently checked out branch of the Git repositoryReturns the currentHEAD
commit of the Git repositoryReturns the Git ref used as theHEAD
commit of the repositoryReturns aMailMap
object that holds information from Git's.mailmap
filegetTags()
Returns a map of tags available in this repositoryReturns the worktree of the repositoryboolean
Returns whether this repository instance has been checkedboolean
isDirty
(boolean ignoreUntracked) Returns whether the worktree of the repository is in a clean stateboolean
Returns whether this repository is currently on an “unborn” branch An “unborn” branch is a branch without any actual commits.void
Load tag meta datavoid
setHeadRef
(String headRef) Sets the Git ref to use as theHEAD
commit of the repositoryvoid
walkCommits
(CommitWalkAction action) Runs the given action for all commits reachable from the currentHEAD
commit
-
Methodendetails
-
check
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 SchnittstelleAutoCloseable
-
describe
Describes the current Git commit likegit describe
does- Gibt zurück:
- The description of the current
HEAD
commit - Löst aus:
GitRepositoryException
- if the description cannot be created
-
getAbbreviatedCommitId
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
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
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
Returns the currentHEAD
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 theHEAD
commit of the repository- Gibt zurück:
- The ref used as
HEAD
-
getMailMap
Returns aMailMap
object that holds information from Git's.mailmap
file- Gibt zurück:
- A
.mailmap
representation ornull
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 repositoryThe 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
Returns whether the worktree of the repository is in a clean state- Parameter:
ignoreUntracked
- Iftrue
, 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
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 actuallyHEAD
. 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
Sets the Git ref to use as theHEAD
commit of the repository- Parameter:
headRef
- The ref to use asHEAD
-
loadTag
Load tag meta data- Parameter:
tag
- The tag to load information for- Löst aus:
GitRepositoryException
- if tag metadata cannot be loaded
-
walkCommits
Runs the given action for all commits reachable from the currentHEAD
commit- Parameter:
action
- The action to execute for each commit found- Löst aus:
GitRepositoryException
- if an error occurs during walking through the commits
-