Xgit v0.1.2 Xgit.Repository.WorkingTree.ParseIndexFile

Parse a git index file and turn it into a corresponding Xgit.Core.DirCache structure.

Link to this section Summary

Types

Error codes which can be returned by from_iodevice/1.

Functions

Read index file from an IO.device (typically an opened file) and returns a corresponding Xgit.Core.DirCache struct.

Link to this section Types

Link to this type

from_iodevice_reason()
from_iodevice_reason() ::
  :invalid_format | :unsupported_version | :too_many_entries

Error codes which can be returned by from_iodevice/1.

Link to this section Functions

Link to this function

from_iodevice(iodevice)
from_iodevice(iodevice :: IO.device()) ::
  {:ok, dir_cache :: Xgit.Core.DirCache.t()}
  | {:error, reason :: from_iodevice_reason()}

Read index file from an IO.device (typically an opened file) and returns a corresponding Xgit.Core.DirCache struct.

Return Value

{:ok, dir_cache} if the iodevice contains a valid index file.

{:error, :invalid_format} if the iodevice can not be parsed as an index file.

{:error, :unsupported_version} if the index file is not a version 2 index file. Other versions are not supported at this time.

{:error, :too_many_entries} if the index files contains more than 100,000 entries. This is an arbitrary limit to guard against malformed files and to prevent overconsumption of memory. With experience, it could be revisited.