Klasse JGitRepository
java.lang.Object
com.github.koraktor.mavanagaiata.git.AbstractGitRepository
com.github.koraktor.mavanagaiata.git.jgit.JGitRepository
- Alle implementierten Schnittstellen:
GitRepository
,AutoCloseable
Wrapper around JGit's
Repository
object to represent a Git
repository- Autor:
- Sebastian Staudt
-
Feldübersicht
Modifizierer und TypFeldBeschreibungprivate boolean
(Package privat) static final String
(Package privat) static final Pattern
(Package privat) static final String
(Package privat) RevCommit
(Package privat) ObjectId
private static final String
(Package privat) static final String
(Package privat) Repository
Von Klasse geerbte Felder com.github.koraktor.mavanagaiata.git.AbstractGitRepository
headRef
-
Konstruktorübersicht
KonstruktorBeschreibungCreates a new empty instanceJGitRepository
(File workTree, File gitDir, String headRef) Creates a new instance for the given worktree and or Git directory -
Methodenübersicht
Modifizierer und TypMethodeBeschreibung(Package privat) final void
buildRepository
(File workTree, File gitDir) void
check()
Checks whether the Git repository is accessible.void
close()
Closes any resources that are needed to access this repository(Package privat) IndexDiff
Creates a new JGitIndexDiff
instance for this repository and worktreedescribe()
Describes the current Git commit likegit describe
doesgetAbbreviatedCommitId
(GitCommit commit) Returns the abbreviated commit SHA ID of the given Git commitReturns the currently checked out branch of the Git repository(Package privat) DescribeCommand
Returns the currentHEAD
commit of the Git repository(Package privat) ObjectId
Returns the object for the Git ref currently set asHEAD
Returns the Git ref used as theHEAD
commit of the repository(Package privat) RevCommit
Returns a commit object forHEAD
(Package privat) FileRepositoryBuilder
Creates a new JGitFileRepositoryBuilder
instance(Package privat) RevWalk
getTags()
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 dataprivate void
resolveGitDir
(File workTree, FileRepositoryBuilder repositoryBuilder) private void
resolveLinkedWorkTree
(File workTree, File foundGitDir, FileRepositoryBuilder repositoryBuilder) void
walkCommits
(CommitWalkAction action) Runs the given action for all commits reachable from the currentHEAD
commitVon Klasse geerbte Methoden com.github.koraktor.mavanagaiata.git.AbstractGitRepository
getAbbreviatedCommitId, getMailMap, setHeadRef
-
Felddetails
-
COMMONDIR_FILE
- Siehe auch:
-
DESCRIBE_PATTERN
-
GITDIR_FILE
- Siehe auch:
-
INDEX_FILE
- Siehe auch:
-
REF_LINK_PREFIX
- Siehe auch:
-
checked
private boolean checked -
repository
Repository repository -
headCommit
RevCommit headCommit -
headObject
ObjectId headObject
-
-
Konstruktordetails
-
JGitRepository
JGitRepository()Creates a new empty instance -
JGitRepository
Creates a new instance for the given worktree and or Git directory- Parameter:
workTree
- The worktree of the repository ornull
gitDir
- The GIT_DIR of the repository ornull
headRef
- The ref to use asHEAD
- Löst aus:
GitRepositoryException
- if the parameters do not match a Git repository
-
-
Methodendetails
-
buildRepository
- Löst aus:
GitRepositoryException
-
check
Beschreibung aus Schnittstelle kopiert:GitRepository
Checks whether the Git repository is accessible.- Löst aus:
GitRepositoryException
- if the repository is not accessible.
-
close
public void close()Closes any resources that are needed to access this repositoryCloses JGit's repository instance.
- Siehe auch:
-
describe
Beschreibung aus Schnittstelle kopiert:GitRepository
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
-
getHeadRef
Beschreibung aus Schnittstelle kopiert:GitRepository
Returns the Git ref used as theHEAD
commit of the repository- Gibt zurück:
- The ref used as
HEAD
-
getAbbreviatedCommitId
Beschreibung aus Schnittstelle kopiert:GitRepository
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
Beschreibung aus Schnittstelle kopiert:GitRepository
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
-
getDescribeCommand
DescribeCommand getDescribeCommand() -
getHeadCommit
Beschreibung aus Schnittstelle kopiert:GitRepository
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
-
createIndexDiff
Creates a new JGitIndexDiff
instance for this repository and worktree- Gibt zurück:
- A new index diff
- Löst aus:
GitRepositoryException
- if theHEAD
object cannot be resolvedIOException
- if the index diff cannot be created
-
getRepositoryBuilder
FileRepositoryBuilder getRepositoryBuilder()Creates a new JGitFileRepositoryBuilder
instance- Gibt zurück:
- A new repository builder
-
getTags
Beschreibung aus Schnittstelle kopiert:GitRepository
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
Beschreibung aus Schnittstelle kopiert:GitRepository
Returns the worktree of the repository- Gibt zurück:
- The worktree of the repository
-
isChecked
public boolean isChecked()Beschreibung aus Schnittstelle kopiert:GitRepository
Returns whether this repository instance has been checked- Gibt zurück:
true
if this repository has already been checked- Siehe auch:
-
isDirty
Beschreibung aus Schnittstelle kopiert:GitRepository
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
Beschreibung aus Schnittstelle kopiert:GitRepository
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
-
loadTag
Beschreibung aus Schnittstelle kopiert:GitRepository
Load tag meta data- Parameter:
tag
- The tag to load information for- Löst aus:
GitRepositoryException
- if tag metadata cannot be loaded
-
walkCommits
Beschreibung aus Schnittstelle kopiert:GitRepository
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
-
getHeadRevCommit
Returns a commit object forHEAD
- Gibt zurück:
- The commit object for
HEAD
- Löst aus:
GitRepositoryException
- if the commit object cannot be retrieved- Siehe auch:
-
getHeadObject
Returns the object for the Git ref currently set asHEAD
- Gibt zurück:
- The currently selected
HEAD
object - Löst aus:
GitRepositoryException
- if the ref cannot be resolved
-
getRevWalk
RevWalk getRevWalk()- Gibt zurück:
- A new JGit
RevWalk
instance for this repository
-
resolveGitDir
private void resolveGitDir(File workTree, FileRepositoryBuilder repositoryBuilder) throws GitRepositoryException - Löst aus:
GitRepositoryException
-
resolveLinkedWorkTree
private void resolveLinkedWorkTree(File workTree, File foundGitDir, FileRepositoryBuilder repositoryBuilder) throws IOException - Löst aus:
IOException
-