Class DescribeCommand

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

    public class DescribeCommand
    extends org.eclipse.jgit.api.GitCommand<DescribeResult>
    Implements git's
    describe
    command.
    • Method Detail

      • on

        @Nonnull
        public static DescribeCommand on​(java.lang.String evaluateOnCommit,
                                         org.eclipse.jgit.lib.Repository repo,
                                         LogInterface log)
        Creates a new describe command which interacts with a single repository
        Parameters:
        evaluateOnCommit - the commit that should be used as reference to generate the properties from
        repo - the Repository this command should interact with
        log - logger bridge to direct logs to
        Returns:
        itself with the options set as specified by the arguments to allow fluent configuration
      • always

        @Nonnull
        public DescribeCommand always​(boolean always)
        --always
        Show uniquely abbreviated commit object as fallback.
        true
        by default.
        Parameters:
        always - set to `true` when you want the describe command show uniquely abbreviated commit object as fallback.
        Returns:
        itself with the `--always` option set as specified by the argument to allow fluent configuration
      • forceLongFormat

        @Nonnull
        public DescribeCommand forceLongFormat​(@Nullable
                                               java.lang.Boolean forceLongFormat)
        --long
        Always output the long format (the tag, the number of commits and the abbreviated commit name) even when it matches a tag. This is useful when you want to see parts of the commit object name in "describe" output, even when the commit in question happens to be a tagged version. Instead of just emitting the tag name, it will describe such a commit as v1.2-0-gdeadbee (0th commit since tag v1.2 that points at object deadbee....).
        false
        by default.
        Parameters:
        forceLongFormat - set to `true` if you always want to output the long format
        Returns:
        itself with the `--long` option set as specified by the argument to allow fluent configuration
      • abbrev

        @Nonnull
        public DescribeCommand abbrev​(@Nullable
                                      java.lang.Integer n)
        --abbrev=N
        Instead of using the default 7 hexadecimal digits as the abbreviated object name, use N digits, or as many digits as needed to form a unique object name. An `n` of 0 will suppress long format, only showing the closest tag.
        Parameters:
        n - the length of the abbreviated object name
        Returns:
        itself with the `--abbrev` option set as specified by the argument to allow fluent configuration
      • tags

        @Nonnull
        public DescribeCommand tags​(@Nullable
                                    java.lang.Boolean includeLightweightTagsInSearch)
        --tags

        Instead of using only the annotated tags, use any tag found in .git/refs/tags. This option enables matching a lightweight (non-annotated) tag.

        Searching for lightweight tags is false by default.

        Example:
            b6a73ed - (HEAD, master)
            d37a598 - (v1.0-fixed-stuff) - a lightweight tag (with no message)
            9597545 - (v1.0) - an annotated tag
        
          $ git describe
            annotated-tag-2-gb6a73ed     # the nearest "annotated" tag is found
        
          $ git describe --tags
            lightweight-tag-1-gb6a73ed   # the nearest tag (including lightweights) is found
         

        Using only annotated tags to mark builds may be useful if you're using tags to help yourself with annotating things like "i'll get back to that" etc - you don't need such tags to be exposed. But if you want lightweight tags to be included in the search, enable this option.

        Parameters:
        includeLightweightTagsInSearch - set to `true` if you want to matching a lightweight (non-annotated) tag
        Returns:
        itself with the `--tags` option set as specified by the argument to allow fluent configuration
      • tags

        public DescribeCommand tags()
        Alias for tags(Boolean) with true value
        Returns:
        itself with the `--tags` option set to `true` to allow fluent configuration
      • apply

        @Nonnull
        public DescribeCommand apply​(@Nullable
                                     GitDescribeConfig config)
        Apply all configuration options passed in with `config`. If a setting is null, it will not be applied - so for abbrev for example, the default 7 would be used.
        Parameters:
        config - A configuration that shall be applied to the current one
        Returns:
        itself, after applying the settings
      • dirty

        @Nonnull
        public DescribeCommand dirty​(@Nullable
                                     java.lang.String dirtyMarker)
        --dirty[=mark]
        Describe the working tree. It means describe HEAD and appends mark (
        -dirty
        by default) if the working tree is dirty.
        Parameters:
        dirtyMarker - the marker name to be appended to the describe output when the workspace is dirty
        Returns:
        itself with the `--dirty` option set as specified by the argument to allow fluent configuration
      • match

        @Nonnull
        public DescribeCommand match​(@Nullable
                                     java.lang.String pattern)
        --match glob-pattern
        Consider only those tags which match the given glob pattern.
        Parameters:
        pattern - the glob style pattern to match against the tag names
        Returns:
        itself with the `--match` option set as specified by the argument to allow fluent configuration
      • call

        public DescribeResult call()
                            throws org.eclipse.jgit.api.errors.GitAPIException
        Specified by:
        call in interface java.util.concurrent.Callable<DescribeResult>
        Specified by:
        call in class org.eclipse.jgit.api.GitCommand<DescribeResult>
        Throws:
        org.eclipse.jgit.api.errors.GitAPIException