Xgit v0.1.6 Xgit.Plumbing.UpdateIndex.CacheInfo View Source

Update the index file to reflect new contents.

Analogous to the --cacheinfo form of git update-index.

Link to this section Summary

Types

Cache info tuple {mode, object_id, path} to add to the index file.

Reason codes that can be returned by run/2.

Functions

Update the index file to reflect new contents.

Link to this section Types

Link to this type

add_entry()

View Source
add_entry() ::
  {mode :: Xgit.Core.FileMode.t(), object_id :: Xgit.Core.ObjectId.t(),
   path :: [byte()]}

Cache info tuple {mode, object_id, path} to add to the index file.

Link to this type

reason()

View Source
reason() ::
  :invalid_repository
  | :invalid_entry
  | :bare
  | Xgit.Repository.WorkingTree.update_dir_cache_reason()

Reason codes that can be returned by run/2.

Link to this section Functions

Link to this function

run(repository, add, remove \\ [])

View Source
run(repository :: Xgit.Repository.t(), add :: [add_entry()], remove :: [byte()]) ::
  :ok | {:error, reason()}

Update the index file to reflect new contents.

Parameters

repository is the Xgit.Repository (PID) to which the new entries should be written.

add: a list of tuples of {mode, object_id, path} entries to add to the dir cache. In the event of collisions with existing entries, the existing entries will be replaced with the corresponding new entries.

remove: a list of paths to remove from the dir cache. All versions of the file, regardless of stage, will be removed.

Return Value

:ok if successful.

{:error, :invalid_repository} if repository doesn't represent a valid Xgit.Repository process.

{:error, :bare} if repository doesn't have a working tree.

{:error, :invalid_entry} if any tuple passed to add or remove was invalid.

{:error, :reason} if unable. The relevant reason codes may come from Xgit.Repository.WorkingTree.update_dir_cache/3.