class Agate::RefTransaction

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.cr

Class Method Summary

Instance Method Summary

Class Method Detail

def self.open(repo : Repository, &) : Nil #

Opens a new ref transaction, yields it, commits on success, and frees on exit.


[View source]

Instance Method Detail

def commit : Nil #

Commits the transaction. All locked references are updated atomically.


[View source]
def free : Nil #

Frees the transaction. Called automatically by .open.


[View source]
def lock(refname : String) : Nil #

Locks a reference for update within this transaction.


[View source]
def remove(refname : String) : Nil #

Marks a locked reference for removal.


[View source]
def set_symbolic_target(refname : String, target : String, sig : Signature, message : String = "") : Nil #

Sets the target of a locked reference to a symbolic reference.


[View source]
def set_target(refname : String, target : OID, sig : Signature, message : String = "") : Nil #

Sets the target of a locked reference to a direct OID.


[View source]