Do not store reference to store path in the hook objects
This commit is contained in:
parent
6714f4e3c7
commit
112646c002
4 changed files with 30 additions and 30 deletions
|
@ -23,27 +23,27 @@ use vcs::git::error::GitHookErrorKind as GHEK;
|
|||
use vcs::git::error::GitHookError as GHE;
|
||||
use vcs::git::runtime::Runtime;
|
||||
|
||||
pub struct CreateHook<'a> {
|
||||
storepath: &'a PathBuf,
|
||||
pub struct CreateHook {
|
||||
storepath: PathBuf,
|
||||
|
||||
runtime: Runtime,
|
||||
|
||||
position: HookPosition,
|
||||
}
|
||||
|
||||
impl<'a> CreateHook<'a> {
|
||||
impl CreateHook {
|
||||
|
||||
pub fn new(storepath: &'a PathBuf, p: HookPosition) -> CreateHook<'a> {
|
||||
pub fn new(storepath: PathBuf, p: HookPosition) -> CreateHook {
|
||||
CreateHook {
|
||||
runtime: Runtime::new(&storepath),
|
||||
storepath: storepath,
|
||||
runtime: Runtime::new(storepath),
|
||||
position: p,
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl<'a> Debug for CreateHook<'a> {
|
||||
impl Debug for CreateHook {
|
||||
|
||||
fn fmt(&self, fmt: &mut Formatter) -> RResult<(), FmtError> {
|
||||
write!(fmt, "CreateHook(storepath={:?}, repository={}, pos={:?}, cfg={:?}",
|
||||
|
@ -54,7 +54,7 @@ impl<'a> Debug for CreateHook<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Hook for CreateHook<'a> {
|
||||
impl Hook for CreateHook {
|
||||
|
||||
fn name(&self) -> &'static str {
|
||||
"stdhook_git_create"
|
||||
|
@ -68,14 +68,14 @@ impl<'a> Hook for CreateHook<'a> {
|
|||
|
||||
}
|
||||
|
||||
impl<'a> HookDataAccessorProvider for CreateHook<'a> {
|
||||
impl HookDataAccessorProvider for CreateHook {
|
||||
|
||||
fn accessor(&self) -> HookDataAccessor {
|
||||
HookDataAccessor::StoreIdAccess(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> StoreIdAccessor for CreateHook<'a> {
|
||||
impl StoreIdAccessor for CreateHook {
|
||||
|
||||
fn access(&self, id: &StoreId) -> HookResult<()> {
|
||||
use vcs::git::action::StoreAction;
|
||||
|
|
|
@ -10,16 +10,16 @@ use libimagstore::hook::accessor::{HookDataAccessor, HookDataAccessorProvider};
|
|||
use libimagstore::hook::accessor::StoreIdAccessor;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct DeleteHook<'a> {
|
||||
storepath: &'a PathBuf,
|
||||
pub struct DeleteHook {
|
||||
storepath: PathBuf,
|
||||
|
||||
position: HookPosition,
|
||||
config: Option<Value>,
|
||||
}
|
||||
|
||||
impl<'a> DeleteHook<'a> {
|
||||
impl DeleteHook {
|
||||
|
||||
pub fn new(storepath: &'a PathBuf, p: HookPosition) -> DeleteHook<'a> {
|
||||
pub fn new(storepath: PathBuf, p: HookPosition) -> DeleteHook {
|
||||
DeleteHook {
|
||||
storepath: storepath,
|
||||
position: p,
|
||||
|
@ -29,7 +29,7 @@ impl<'a> DeleteHook<'a> {
|
|||
|
||||
}
|
||||
|
||||
impl<'a> Hook for DeleteHook<'a> {
|
||||
impl Hook for DeleteHook {
|
||||
|
||||
fn name(&self) -> &'static str {
|
||||
"stdhook_git_delete"
|
||||
|
@ -41,14 +41,14 @@ impl<'a> Hook for DeleteHook<'a> {
|
|||
|
||||
}
|
||||
|
||||
impl<'a> HookDataAccessorProvider for DeleteHook<'a> {
|
||||
impl HookDataAccessorProvider for DeleteHook {
|
||||
|
||||
fn accessor(&self) -> HookDataAccessor {
|
||||
HookDataAccessor::StoreIdAccess(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> StoreIdAccessor for DeleteHook<'a> {
|
||||
impl StoreIdAccessor for DeleteHook {
|
||||
|
||||
fn access(&self, id: &StoreId) -> HookResult<()> {
|
||||
debug!("[GIT DELETE HOOK]: {:?}", id);
|
||||
|
|
|
@ -10,16 +10,16 @@ use libimagstore::hook::accessor::{HookDataAccessor, HookDataAccessorProvider};
|
|||
use libimagstore::hook::accessor::StoreIdAccessor;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct RetrieveHook<'a> {
|
||||
storepath: &'a PathBuf,
|
||||
pub struct RetrieveHook {
|
||||
storepath: PathBuf,
|
||||
|
||||
position: HookPosition,
|
||||
config: Option<Value>,
|
||||
}
|
||||
|
||||
impl<'a> RetrieveHook<'a> {
|
||||
impl RetrieveHook {
|
||||
|
||||
pub fn new(storepath: &'a PathBuf, p: HookPosition) -> RetrieveHook<'a> {
|
||||
pub fn new(storepath: PathBuf, p: HookPosition) -> RetrieveHook {
|
||||
RetrieveHook {
|
||||
storepath: storepath,
|
||||
position: p,
|
||||
|
@ -29,7 +29,7 @@ impl<'a> RetrieveHook<'a> {
|
|||
|
||||
}
|
||||
|
||||
impl<'a> Hook for RetrieveHook<'a> {
|
||||
impl Hook for RetrieveHook {
|
||||
|
||||
fn name(&self) -> &'static str {
|
||||
"stdhook_git_retrieve"
|
||||
|
@ -41,14 +41,14 @@ impl<'a> Hook for RetrieveHook<'a> {
|
|||
|
||||
}
|
||||
|
||||
impl<'a> HookDataAccessorProvider for RetrieveHook<'a> {
|
||||
impl HookDataAccessorProvider for RetrieveHook {
|
||||
|
||||
fn accessor(&self) -> HookDataAccessor {
|
||||
HookDataAccessor::StoreIdAccess(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> StoreIdAccessor for RetrieveHook<'a> {
|
||||
impl StoreIdAccessor for RetrieveHook {
|
||||
|
||||
fn access(&self, id: &StoreId) -> HookResult<()> {
|
||||
debug!("[GIT RETRIEVE HOOK]: {:?}", id);
|
||||
|
|
|
@ -10,16 +10,16 @@ use libimagstore::hook::accessor::{HookDataAccessor, HookDataAccessorProvider};
|
|||
use libimagstore::hook::accessor::StoreIdAccessor;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct UpdateHook<'a> {
|
||||
storepath: &'a PathBuf,
|
||||
pub struct UpdateHook {
|
||||
storepath: PathBuf,
|
||||
|
||||
position: HookPosition,
|
||||
config: Option<Value>,
|
||||
}
|
||||
|
||||
impl<'a> UpdateHook<'a> {
|
||||
impl UpdateHook {
|
||||
|
||||
pub fn new(storepath: &'a PathBuf, p: HookPosition) -> UpdateHook<'a> {
|
||||
pub fn new(storepath: PathBuf, p: HookPosition) -> UpdateHook {
|
||||
UpdateHook {
|
||||
storepath: storepath,
|
||||
position: p,
|
||||
|
@ -29,7 +29,7 @@ impl<'a> UpdateHook<'a> {
|
|||
|
||||
}
|
||||
|
||||
impl<'a> Hook for UpdateHook<'a> {
|
||||
impl Hook for UpdateHook {
|
||||
|
||||
fn name(&self) -> &'static str {
|
||||
"stdhook_git_update"
|
||||
|
@ -41,14 +41,14 @@ impl<'a> Hook for UpdateHook<'a> {
|
|||
|
||||
}
|
||||
|
||||
impl<'a> HookDataAccessorProvider for UpdateHook<'a> {
|
||||
impl HookDataAccessorProvider for UpdateHook {
|
||||
|
||||
fn accessor(&self) -> HookDataAccessor {
|
||||
HookDataAccessor::StoreIdAccess(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> StoreIdAccessor for UpdateHook<'a> {
|
||||
impl StoreIdAccessor for UpdateHook {
|
||||
|
||||
fn access(&self, id: &StoreId) -> HookResult<()> {
|
||||
debug!("[GIT UPDATE HOOK]: {:?}", id);
|
||||
|
|
Loading…
Reference in a new issue