Package net.kyori.indra.git.internal
Class IndraGitExtensionImpl
- java.lang.Object
-
- net.kyori.indra.git.internal.IndraGitExtensionImpl
-
- All Implemented Interfaces:
IndraGitExtension
public class IndraGitExtensionImpl extends Object implements IndraGitExtension
-
-
Field Summary
-
Fields inherited from interface net.kyori.indra.git.IndraGitExtension
MANIFEST_ATTRIBUTE_GIT_BRANCH, MANIFEST_ATTRIBUTE_GIT_COMMIT
-
-
Constructor Summary
Constructors Constructor Description IndraGitExtensionImpl(File projectDir, String displayName, org.gradle.api.provider.Provider<IndraGitService> service)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable org.eclipse.jgit.lib.Refbranch()Get an object pointing to the current branch.@Nullable StringbranchName()Get the name of the current branch.@Nullable org.eclipse.jgit.lib.ObjectIdcommit()Get the ID of the current commit.@Nullable Stringdescribe()Get agit describestring for the project's repository.@Nullable org.eclipse.jgit.api.Gitgit()Access the underlying Git repository.@Nullable org.eclipse.jgit.lib.RefheadTag()Get the tag pointing to the commit checked out asHEAD.@NotNull List<org.eclipse.jgit.lib.Ref>tags()Get all tags created on this repository.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.kyori.indra.git.IndraGitExtension
applyVcsInformationToManifest, isPresent
-
-
-
-
Constructor Detail
-
IndraGitExtensionImpl
@Inject public IndraGitExtensionImpl(File projectDir, String displayName, org.gradle.api.provider.Provider<IndraGitService> service)
-
-
Method Detail
-
git
@Nullable public @Nullable org.eclipse.jgit.api.Git git()
Description copied from interface:IndraGitExtensionAccess the underlying Git repository.This will look for a git repository in the root project directory.
This will search in the current project's directory, and if the project is not a git checkout, will traverse parent directories until a
.gitfolder is found.- Specified by:
gitin interfaceIndraGitExtension- Returns:
- the git repository
-
tags
@NotNull public @NotNull List<org.eclipse.jgit.lib.Ref> tags()
Description copied from interface:IndraGitExtensionGet all tags created on this repository.- Specified by:
tagsin interfaceIndraGitExtension- Returns:
- the tags on this repository, or an empty list if this project is not in a git repository
-
headTag
@Nullable public @Nullable org.eclipse.jgit.lib.Ref headTag()
Description copied from interface:IndraGitExtensionGet the tag pointing to the commit checked out asHEAD.- Specified by:
headTagin interfaceIndraGitExtension- Returns:
- the tag at
HEAD, ornullif the project is not in a git repository or is not checked out to a tag
-
describe
@Nullable public @Nullable String describe()
Description copied from interface:IndraGitExtensionGet agit describestring for the project's repository.The result will be equivalent to the result of executing
git describe --tags --long- Specified by:
describein interfaceIndraGitExtension- Returns:
- the describe string, or
nullif this project is not in a git repository or if there are no tags in the project's history
-
branchName
@Nullable public @Nullable String branchName()
Description copied from interface:IndraGitExtensionGet the name of the current branch.- Specified by:
branchNamein interfaceIndraGitExtension- Returns:
- the name of the active branch, or
nullif the project is not in a git repository or is checked out to a detachedHEAD.
-
branch
@Nullable public @Nullable org.eclipse.jgit.lib.Ref branch()
Description copied from interface:IndraGitExtensionGet an object pointing to the current branch.- Specified by:
branchin interfaceIndraGitExtension- Returns:
- the active branch, or
nullif the project is not in a git repository or is checked out to a detachedHEAD.
-
commit
@Nullable public @Nullable org.eclipse.jgit.lib.ObjectId commit()
Description copied from interface:IndraGitExtensionGet the ID of the current commit.- Specified by:
commitin interfaceIndraGitExtension- Returns:
- the commit id, or
nullif the project is not in a git repository or has not had its initial commit
-
-