Class IndraGitExtensionImpl

    • Constructor Detail

      • IndraGitExtensionImpl

        @Inject
        public IndraGitExtensionImpl​(org.gradle.api.Project project,
                                     org.gradle.api.provider.Provider<IndraGitService> service)
    • Method Detail

      • git

        @Nullable
        public @Nullable org.eclipse.jgit.api.Git git()
        Description copied from interface: IndraGitExtension
        Access 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 .git folder is found.

        Specified by:
        git in interface IndraGitExtension
        Returns:
        the git repository
      • tags

        @NotNull
        public @NotNull List<org.eclipse.jgit.lib.Ref> tags()
        Description copied from interface: IndraGitExtension
        Get all tags created on this repository.
        Specified by:
        tags in interface IndraGitExtension
        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: IndraGitExtension
        Get the tag pointing to the commit checked out as HEAD.
        Specified by:
        headTag in interface IndraGitExtension
        Returns:
        the tag at HEAD, or null if 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: IndraGitExtension
        Get a git describe string for the project's repository.

        The result will be equivalent to the result of executing git describe --tags --long

        Specified by:
        describe in interface IndraGitExtension
        Returns:
        the describe string, or null if 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: IndraGitExtension
        Get the name of the current branch.
        Specified by:
        branchName in interface IndraGitExtension
        Returns:
        the name of the active branch, or null if the project is not in a git repository or is checked out to a detached HEAD.
      • branch

        @Nullable
        public @Nullable org.eclipse.jgit.lib.Ref branch()
        Description copied from interface: IndraGitExtension
        Get an object pointing to the current branch.
        Specified by:
        branch in interface IndraGitExtension
        Returns:
        the active branch, or null if the project is not in a git repository or is checked out to a detached HEAD.
      • commit

        @Nullable
        public @Nullable org.eclipse.jgit.lib.ObjectId commit()
        Description copied from interface: IndraGitExtension
        Get the ID of the current commit.
        Specified by:
        commit in interface IndraGitExtension
        Returns:
        the commit id, or null if the project is not in a git repository or has not had its initial commit