pub struct Hooks { /* private fields */ }
Implementations§
Source§impl Hooks
impl Hooks
pub fn new(hook_root: impl Into<PathBuf>) -> Self
pub fn with_repo(repo: &Repository) -> Result<Self, Error>
pub fn root(&self) -> &Path
pub fn find_hook(&self, _repo: &Repository, name: &str) -> Option<PathBuf>
pub fn run_hook( &self, repo: &Repository, name: &str, args: &[&str], stdin: Option<&[u8]>, env: &[(&str, &str)], ) -> Result<i32, Error>
Sourcepub fn run_post_rewrite_rebase(
&self,
repo: &Repository,
changed_oids: &[(Oid, Oid)],
)
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
Sourcepub fn run_reference_transaction<'t>(
&'t self,
repo: &'t Repository,
changed_refs: &'t [(Oid, Oid, &'t str)],
) -> Result<ReferenceTransaction<'t>, Error>
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 refold
is zeroed out when force updating the reference regardless of its current value or when the reference is to be created anew
Sourcepub fn run_reference_transaction_prepare(
&self,
repo: &Repository,
changed_refs: &[(Oid, Oid, &str)],
) -> Result<(), Error>
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 refold
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
Sourcepub fn run_reference_transaction_committed(
&self,
repo: &Repository,
changed_refs: &[(Oid, Oid, &str)],
)
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 refold
is zeroed out when force updating the reference regardless of its current value or when the reference is to be created anew
Sourcepub fn run_reference_transaction_aborted(
&self,
repo: &Repository,
changed_refs: &[(Oid, Oid, &str)],
)
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 refold
is zeroed out when force updating the reference regardless of its current value or when the reference is to be created anew