Enum Class GitDiffHeader

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

public enum GitDiffHeader extends Enum<GitDiffHeader>
Defines headers which may appear in git diff output. These will appear after the diff --git banner and before any hunks.
  • Enum Constant Details

    • COPY_FROM

      public static final GitDiffHeader COPY_FROM
      Defines the source path for a copied file.
    • COPY_TO

      public static final GitDiffHeader COPY_TO
      Defines the destination path for a copied file.
    • DELETED_FILE_MODE

      public static final GitDiffHeader DELETED_FILE_MODE
      Defines the file mode a source file had before it was deleted.
    • DISSIMILARITY_INDEX

      public static final GitDiffHeader DISSIMILARITY_INDEX
      Defines the percentage of dissimilarity between a source file and a copied/renamed/moved destination file.
    • INDEX

      public static final GitDiffHeader INDEX
      Defines git index data, such as content hashes, for the source and destination files.
    • NEW_FILE_MODE

      public static final GitDiffHeader NEW_FILE_MODE
      Defines the file mode for a newly-added destination file.
    • NEW_MODE

      public static final GitDiffHeader NEW_MODE
      Defines the new mode for a destination file.
    • OLD_MODE

      public static final GitDiffHeader OLD_MODE
      Defines the original mode for a source file.
    • RENAME_FROM

      public static final GitDiffHeader RENAME_FROM
      Defines the source path for a renamed/moved file.
    • RENAME_TO

      public static final GitDiffHeader RENAME_TO
      Defines the destination path for a renamed/moved file.
    • SIMILARITY_INDEX

      public static final GitDiffHeader SIMILARITY_INDEX
      Defines the percentage of similarity between a source file and a copied/renamed/moved destination file.
  • Method Details

    • values

      public static GitDiffHeader[] 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 GitDiffHeader 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
    • getKey

      public String getKey()
      Retrieves the key identifying this header in an output line.

      Note: Header keys may contain one or more spaces, so indexOf-based splitting should not be used.

      Returns:
      the header key
    • getTarget

      public GitDiffTarget getTarget()
      Retrieves the target to which the value of this header applies. The header type will indicate whether a specific target is available.
      Returns:
      the header target
    • getType

      public GitDiffHeaderType getType()
      Retrieves the type of data provided by the header value. The type also indicates whether a specific target is related to this header.
      Returns:
      the header type
    • getValue

      public String getValue(String line)
      Removes the leading key from the provided line and returns the value.
      Parameters:
      line - the line to split
      Returns:
      the value part of the line