Enum Class GitChangeType

java.lang.Object
java.lang.Enum<GitChangeType>
com.atlassian.bitbucket.scm.git.command.diff.GitChangeType
All Implemented Interfaces:
Serializable, Comparable<GitChangeType>, Constable

public enum GitChangeType extends Enum<GitChangeType>
A git-specific extension of the general ChangeType enumeration more tightly linked to its change output.

All of the names used here are strongly influenced by git's documentation, and status codes are linked to each type. These names and codes are drawn from documentation from git help diff-tree (which is shared with several other commands).

  • Enum Constant Details

    • ADD

      public static final GitChangeType ADD
      A: addition of a file
    • COPY

      public static final GitChangeType COPY
      C: copy of a file into a new one
    • DELETE

      public static final GitChangeType DELETE
      D: deletion of a file
    • MODIFY

      public static final GitChangeType MODIFY
      M: modification of the contents or mode of a file
    • RENAME

      public static final GitChangeType RENAME
      R: renaming of a file

      Note: MOVE is generic term for this; RENAME is git's term.

    • TYPE

      public static final GitChangeType TYPE
      T: change in the type of the file
    • UNMERGED

      public static final GitChangeType UNMERGED
      U: file is unmerged (you must complete the merge before it can be committed)

      Note: This status should not be possible in a bare clone, such as what is used to serve a repository.

    • UNKNOWN

      public static final GitChangeType UNKNOWN
      X: "unknown" change type

      Note: Per the git documentation, unknown almost always indicates a bug in git.

  • Method Details

    • values

      public static GitChangeType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static GitChangeType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • fromStatus

      @Nonnull public static GitChangeType fromStatus(@Nullable String status)
      Evaluates all change types to determine if one exists with the provided status code. If no match is found, UNKNOWN is returned.
      Parameters:
      status - the status code to evaluate
      Returns:
      the matching change type, or UNKNOWN if there is no match
    • getStatus

      @Nonnull public String getStatus()
      Retrieves the git status code associated with this change type.
      Returns:
      the status code
    • getType

      @Nonnull public com.atlassian.bitbucket.content.ChangeType getType()
      Retrieves the general ChangeType for this git change type.
      Returns:
      the associated general change type
    • isScored

      public boolean isScored()
      Flag indicating whether git provides a score with changes of this type. "score" is git's term for the similarity percentage between two files.
      Returns:
      true if this change is scored; otherwise false