Xgit v0.1.6 Xgit.Repository.WorkingTree.ParseIndexFile View Source
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
from_iodevice_reason()
View Sourcefrom_iodevice_reason() :: :not_sha_hash_device | :invalid_format | :unsupported_version | :too_many_entries | :extensions_not_supported | :sha_hash_mismatch | File.posix()
Error codes which can be returned by from_iodevice/1
.
Link to this section Functions
from_iodevice(iodevice)
View Sourcefrom_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.
IMPORTANT: The IO.device
must be created using Xgit.Util.TrailingHashDevice
.
Return Value
{:ok, dir_cache}
if the iodevice contains a valid index file.
{:error, :not_sha_hash_device}
if the iodevice was not created using
Xgit.Util.TrailingHashDevice
.
{: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.
{:error, :extensions_not_supported}
if any index file extensions are present.
Parsing extensions is not yet supported. (See
issue #67.)
{:error, :sha_hash_mismatch}
if the SHA-1 hash written at the end of the file
does not match the file contents.