Skip to main content

ReferenceTransactionHook

Trait ReferenceTransactionHook 

Source
pub trait ReferenceTransactionHook {
    // Required method
    fn run(
        &self,
        phase: RefTransactionPhase,
        updates: &[RefTransactionHookUpdate],
    ) -> Result<bool>;
}
Expand description

A handler the file backend invokes at each phase of a ref transaction so the CLI layer can run the project’s reference-transaction hook. Implemented in sley-cli; the backend stays oblivious to how (or whether) a hook script is found and executed.

run returns Ok(true) to mean “the hook ran and requested an abort” (nonzero exit in a preparing/prepared phase), Ok(false) to mean “proceed” (hook absent, succeeded, or a non-abortable phase), and Err only for an I/O failure spawning the hook. The backend turns an abort request in the prepare phases into the git-shaped in '<phase>' phase, update aborted by the reference-transaction hook failure.

Required Methods§

Source

fn run( &self, phase: RefTransactionPhase, updates: &[RefTransactionHookUpdate], ) -> Result<bool>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§