Class GitIdentifiers.DirectoryEntry

java.lang.Object
org.apache.commons.codec.digest.GitIdentifiers.DirectoryEntry
All Implemented Interfaces:
Comparable<GitIdentifiers.DirectoryEntry>
Enclosing class:
GitIdentifiers

static class GitIdentifiers.DirectoryEntry extends Object implements Comparable<GitIdentifiers.DirectoryEntry>
Represents a single entry in a Git tree object.

A Git tree object encodes a directory snapshot. Each entry holds:

  • a GitIdentifiers.FileMode that determines the Unix file mode (e.g. 100644 for a regular file),
  • the entry name (file or directory name, without a path separator),
  • the raw object id of the referenced blob or sub-tree.

Entries are ordered by compareTo(org.apache.commons.codec.digest.GitIdentifiers.DirectoryEntry) using Git's tree-sort rule: directory names are compared as if they ended with '/', so that foo/ sorts after foobar.

See Also:
  • Field Details

    • name

      private final String name
      The entry name (file or directory name, no path separator).
    • rawObjectId

      private final byte[] rawObjectId
      The raw object id of the referenced blob or sub-tree.
    • sortKey

      private final String sortKey
      The key used for ordering entries within a tree object.

      >Git appends '/' to directory names before comparing.

    • type

      private final GitIdentifiers.FileMode type
      The Git object type, which determines the Unix file-mode prefix.
  • Constructor Details

    • DirectoryEntry

      DirectoryEntry(String name, GitIdentifiers.FileMode type, byte[] rawObjectId)
      Constructs a new entry.
      Parameters:
      name - The name of the entry, not containing '/'.
      type - The type of the entry, not null.
      rawObjectId - The id of the entry, not null.
  • Method Details