Xgit v0.4.0 Xgit.Plumbing.UpdateRef View Source
Update the object name stored in a ref.
Analogous to
git update-ref
.
Link to this section Summary
Functions
Translates the current working tree, as reflected in its index file, to one or more tree objects.
Link to this section Types
reason()
View Sourcereason() :: :invalid_repository | Xgit.Repository.put_ref_reason()
Reason codes that can be returned by run/2
.
Link to this section Functions
run(repository, name, new_value, opts \\ [])
View Sourcerun( repository :: Xgit.Repository.t(), name :: Xgit.Core.Ref.name(), new_value :: Xgit.Core.ObjectId.t(), [{:old_target, Xgit.Core.ObjectId.t()}] ) :: :ok | {:error, reason()}
Translates the current working tree, as reflected in its index file, to one or more tree objects.
The working tree must be in a fully-merged state.
Parameters
repository
is the Xgit.Repository
(PID) to search for the object.
name
is the name of the reference to update. (See t/Xgit.Core.Ref.name
.)
new_value
is the object ID to be written at this reference. (Use Xgit.Core.ObjectId.zero/0
to delete the reference.)
Options
old_target
: If present, a ref with this name must already exist and the target
value must match the object ID provided in this option. (There is a special value :new
which instead requires that the named ref must not exist.)
TO DO
Follow symbolic links, but only if they start with refs/
.
(https://github.com/elixir-git/xgit/issues/241)
Return Value
:ok
if written successfully.
{:error, :invalid_repository}
if repository
doesn't represent a valid
Xgit.Repository
process.
Reason codes may also come from the following functions: