Class DescribeCommand

  • All Implemented Interfaces:
    java.util.concurrent.Callable<java.lang.String>

    public class DescribeCommand
    extends GitCommand<java.lang.String>
    Given a commit, show the most recent tag that is reachable from a commit.
    Since:
    3.2
    • Constructor Detail

      • DescribeCommand

        protected DescribeCommand​(Repository repo)
        Parameters:
        repo -
    • Method Detail

      • setTarget

        public DescribeCommand setTarget​(ObjectId target)
                                  throws java.io.IOException
        Sets the commit to be described.
        Parameters:
        target - A non-null object ID to be described.
        Returns:
        this
        Throws:
        MissingObjectException - the supplied commit does not exist.
        IncorrectObjectTypeException - the supplied id is not a commit or an annotated tag.
        java.io.IOException - a pack file or loose object could not be read.
      • call

        public java.lang.String call()
                              throws GitAPIException
        Describes the specified commit. Target defaults to HEAD if no commit was set explicitly.
        Specified by:
        call in interface java.util.concurrent.Callable<java.lang.String>
        Specified by:
        call in class GitCommand<java.lang.String>
        Returns:
        if there's a tag that points to the commit being described, this tag name is returned. Otherwise additional suffix is added to the nearest tag, just like git-describe(1).

        If none of the ancestors of the commit being described has any tags at all, then this method returns null, indicating that there's no way to describe this tag.

        Throws:
        GitAPIException - or subclass thereof when an error occurs