Class DescribeCommand

  • All Implemented Interfaces:
    Callable<String>

    public class DescribeCommand
    extends GitCommand<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)
        Constructor for DescribeCommand.
        Parameters:
        repo - the Repository
    • Method Detail

      • setLong

        public DescribeCommand setLong​(boolean longDesc)
        Determine whether always to use the long format or not. When set to true the long format is used even the commit matches a tag.
        Parameters:
        longDesc - true if always the long format should be used.
        Returns:
        this
        Since:
        4.0
        See Also:
        Git documentation about describe
      • setAll

        public DescribeCommand setAll​(boolean all)
        Instead of using only the annotated tags, use any ref found in refs/ namespace. This option enables matching any known branch, remote-tracking branch, or lightweight tag.
        Parameters:
        all - true enables matching any ref found in refs/ like setting option --all in c git
        Returns:
        this
        Since:
        5.10
      • setTags

        public DescribeCommand setTags​(boolean tags)
        Instead of using only the annotated tags, use any tag found in refs/tags namespace. This option enables matching lightweight (non-annotated) tags or not.
        Parameters:
        tags - true enables matching lightweight (non-annotated) tags like setting option --tags in c git
        Returns:
        this
        Since:
        5.0
      • setAlways

        public DescribeCommand setAlways​(boolean always)
        Always describe the commit by eventually falling back to a uniquely abbreviated commit hash if no other name matches.
        Parameters:
        always - true enables falling back to a uniquely abbreviated commit hash
        Returns:
        this
        Since:
        5.4
      • setAbbrev

        public DescribeCommand setAbbrev​(int abbrev)
        Sets the prefix length to use when abbreviating an object SHA-1.
        Parameters:
        abbrev - minimum length of the abbreviated string. Must be in the range [4, 40].
        Returns:
        this
        Since:
        6.1