Struct Hooks

Source
pub struct Hooks { /* private fields */ }

Implementations§

Source§

impl Hooks

Source

pub fn new(hook_root: impl Into<PathBuf>) -> Self

Source

pub fn with_repo(repo: &Repository) -> Result<Self, Error>

Source

pub fn root(&self) -> &Path

Source

pub fn find_hook(&self, _repo: &Repository, name: &str) -> Option<PathBuf>

Source

pub fn run_hook( &self, repo: &Repository, name: &str, args: &[&str], stdin: Option<&[u8]>, env: &[(&str, &str)], ) -> Result<i32, Error>

Source

pub fn run_post_rewrite_rebase( &self, repo: &Repository, changed_oids: &[(Oid, Oid)], )

Run post-rewrite hook as if called by git rebase

The hook should be run after any automatic note copying (see notes.rewrite.<command> in git-config(1)) has happened, and thus has access to these notes.

changed_shas (old, new):

  • For the squash and fixup operation, all commits that were squashed are listed as being rewritten to the squashed commit. This means that there will be several lines sharing the same new-sha1.
  • The commits are must be listed in the order that they were processed by rebase.
  • git doesn’t include entries for dropped commits
Source

pub fn run_reference_transaction<'t>( &'t self, repo: &'t Repository, changed_refs: &'t [(Oid, Oid, &'t str)], ) -> Result<ReferenceTransaction<'t>, Error>

Run reference-transaction hook to signal that all reference updates have been queued to the transaction.

changed_refs (old, new, name):

  • name is the full name of the ref
  • old is zeroed out when force updating the reference regardless of its current value or when the reference is to be created anew
Source

pub fn run_reference_transaction_prepare( &self, repo: &Repository, changed_refs: &[(Oid, Oid, &str)], ) -> Result<(), Error>

Run reference-transaction hook to signal that all reference updates have been queued to the transaction.

changed_refs (old, new, name):

  • name is the full name of the ref
  • old is zeroed out when force updating the reference regardless of its current value or when the reference is to be created anew

On success, call either

  • run_reference_transaction_committed
  • run_reference_transaction_aborted.

On failure, the transaction is considered aborted

Source

pub fn run_reference_transaction_committed( &self, repo: &Repository, changed_refs: &[(Oid, Oid, &str)], )

Run reference-transaction hook to signal that all reference updates have been applied

changed_refs (old, new, name):

  • name is the full name of the ref
  • old is zeroed out when force updating the reference regardless of its current value or when the reference is to be created anew
Source

pub fn run_reference_transaction_aborted( &self, repo: &Repository, changed_refs: &[(Oid, Oid, &str)], )

Run reference-transaction hook to signal that no changes have been made

changed_refs (old, new, name):

  • name is the full name of the ref
  • old is zeroed out when force updating the reference regardless of its current value or when the reference is to be created anew

Trait Implementations§

Source§

impl Clone for Hooks

Source§

fn clone(&self) -> Hooks

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Hooks

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Hooks

§

impl RefUnwindSafe for Hooks

§

impl Send for Hooks

§

impl Sync for Hooks

§

impl Unpin for Hooks

§

impl UnwindSafe for Hooks

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.