pub struct PushRefs(/* private fields */);Expand description
Lazily-read pushed refs. OnceLock rather than OnceCell because
pre-commit runs its checks on threads and Ctx must therefore be Sync.
Implementations§
Source§impl PushRefs
impl PushRefs
Sourcepub fn get(&self) -> &[PushRef]
pub fn get(&self) -> &[PushRef]
Read on first use. A check that never asks never blocks on stdin — which matters, because pre-commit’s stdin is not a ref list.
Sourcepub fn preloaded(refs: Vec<PushRef>) -> PushRefs
pub fn preloaded(refs: Vec<PushRef>) -> PushRefs
Pre-populated, so .get() never touches stdin at all.
For a context with no real pre-push invocation to read refs from —
amont run <pre-push-check> is the one today — where .get()
would otherwise block reading a TTY that has no ref list coming, or
(piped from /dev/null, say) read nothing and let the check treat an
empty ref list as “nothing to check”: branch-protect calls that “no
push to a protected branch”, and a scope-gated suite just never loops.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for PushRefs
impl RefUnwindSafe for PushRefs
impl Send for PushRefs
impl Sync for PushRefs
impl Unpin for PushRefs
impl UnsafeUnpin for PushRefs
impl UnwindSafe for PushRefs
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more