Xgit v0.1.6 Xgit.Core.DirCache.Entry View Source

A single file (or stage of a file) in a directory cache.

An entry represents exactly one stage of a file. If a file path is unmerged then multiple instances may appear for the same path name.

Link to this section Summary

Types

t()

A single file (or stage of a file) in a directory cache.

Functions

Compare two entries according to git dir cache entry sort ordering rules.

Return true if this entry struct describes a valid dir cache entry.

Link to this section Types

Link to this type

t()

View Source
t() :: %Xgit.Core.DirCache.Entry{
  assume_valid?: boolean(),
  ctime: integer(),
  ctime_ns: non_neg_integer(),
  dev: integer(),
  extended?: boolean(),
  gid: integer(),
  ino: integer(),
  intent_to_add?: boolean(),
  mode: Xgit.Core.FileMode.t(),
  mtime: integer(),
  mtime_ns: non_neg_integer(),
  name: [byte()],
  object_id: Xgit.Core.ObjectId.t(),
  size: non_neg_integer(),
  skip_worktree?: boolean(),
  stage: 0..3,
  uid: integer()
}

A single file (or stage of a file) in a directory cache.

An entry represents exactly one stage of a file. If a file path is unmerged then multiple instances may appear for the same path name.

Consult the documentation for git index file format for a more detailed description of each item.

Struct Members

  • name: entry path name, relative to top-level directory (without leading slash)
  • stage: 0..3 merge status
  • object_id: (ObjectId.t) SHA-1 for the represented object
  • mode: (FileMode.t)
  • size: (integer) on-disk size, possibly truncated to 32 bits
  • ctime: (integer) the last time the file's metadata changed
  • ctime_ns: (integer) nanosecond fraction of ctime (if available)
  • mtime: (integer) the last time a file's contents changed
  • mtime_ns: (integer) nanosecond fractino of mtime (if available)
  • dev: (integer)
  • ino: (integer)
  • uid: (integer)
  • gid: (integer)
  • assume_valid?: (boolean)
  • extended?: (boolean)
  • skip_worktree?: (boolean)
  • intent_to_add?: (boolean)

Link to this section Functions

Link to this function

compare(entry1, entry2)

View Source
compare(entry1 :: t() | nil, entry2 :: t()) :: :lt | :eq | :gt

Compare two entries according to git dir cache entry sort ordering rules.

For this purpose, only the following fields are considered (in this priority order):

  • :name
  • :stage

Return Value

  • :lt if entry1 sorts before entry2.
  • :eq if they are the same.
  • :gt if entry1 sorts after entry2.
Link to this function

valid?(entry)

View Source
valid?(entry :: any()) :: boolean()

Return true if this entry struct describes a valid dir cache entry.