Xgit v0.1.6 Xgit.Repository.WorkingTree.WriteIndexFile View Source

Save an Xgit.Core.DirCache to the corresponding git index file data structure.

Link to this section Summary

Types

Error codes which can be returned by to_iodevice/1.

Functions

Write index file to an iodevice (typically an opened file) from an Xgit.Core.DirCache struct.

Link to this section Types

Link to this type

to_iodevice_reason()

View Source
to_iodevice_reason() ::
  :not_sha_hash_device
  | :invalid_dir_cache
  | :unsupported_version
  | File.posix()

Error codes which can be returned by to_iodevice/1.

Link to this section Functions

Link to this function

to_iodevice(dir_cache, iodevice)

View Source
to_iodevice(dir_cache :: Xgit.Core.DirCache.t(), iodevice :: IO.device()) ::
  :ok | {:error, reason :: to_iodevice_reason()}

Write index file to an iodevice (typically an opened file) from an Xgit.Core.DirCache struct.

IMPORTANT: The iodevice must be created using Xgit.Util.TrailingHashDevice.

Return Value

:ok if written successfully.

{:error, :not_sha_hash_device} if the iodevice was not created using Xgit.Util.TrailingHashDevice.

{:error, :invalid_dir_cache} if Xgit.Core.DirCache.valid?/1 does not return true for this struct.

{:error, :unsupported_version} if the version flag in the dir cache struct is not version. Other versions are not supported at this time.

{:error, posix_reason} if an I/O error occurs.