class
Agate::RefTransaction
- Agate::RefTransaction
- Reference
- Object
Overview
A reference transaction for atomically updating multiple refs.
RefTransaction.open(repo) do |tx|
tx.lock("refs/heads/main")
tx.set_target("refs/heads/main", new_oid, sig, "update main")
end # commits on success, frees on exit
Defined in:
agate/transaction.crClass Method Summary
-
.open(repo : Repository, &) : Nil
Opens a new ref transaction, yields it, commits on success, and frees on exit.
Instance Method Summary
-
#commit : Nil
Commits the transaction.
-
#free : Nil
Frees the transaction.
-
#lock(refname : String) : Nil
Locks a reference for update within this transaction.
-
#remove(refname : String) : Nil
Marks a locked reference for removal.
-
#set_symbolic_target(refname : String, target : String, sig : Signature, message : String = "") : Nil
Sets the target of a locked reference to a symbolic reference.
-
#set_target(refname : String, target : OID, sig : Signature, message : String = "") : Nil
Sets the target of a locked reference to a direct OID.
Class Method Detail
def self.open(repo : Repository, &) : Nil
#
Opens a new ref transaction, yields it, commits on success, and frees on exit.
Instance Method Detail
def set_symbolic_target(refname : String, target : String, sig : Signature, message : String = "") : Nil
#
Sets the target of a locked reference to a symbolic reference.
Sets the target of a locked reference to a direct OID.