Add store path member for update hook
This commit is contained in:
parent
0e765cd5b6
commit
a8ea51460c
1 changed files with 11 additions and 6 deletions
|
@ -1,3 +1,5 @@
|
|||
use std::path::PathBuf;
|
||||
|
||||
use toml::Value;
|
||||
|
||||
use libimagstore::storeid::StoreId;
|
||||
|
@ -8,15 +10,18 @@ use libimagstore::hook::accessor::{HookDataAccessor, HookDataAccessorProvider};
|
|||
use libimagstore::hook::accessor::StoreIdAccessor;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct UpdateHook {
|
||||
pub struct UpdateHook<'a> {
|
||||
storepath: &'a PathBuf,
|
||||
|
||||
position: HookPosition,
|
||||
config: Option<Value>,
|
||||
}
|
||||
|
||||
impl UpdateHook {
|
||||
impl<'a> UpdateHook<'a> {
|
||||
|
||||
pub fn new(p: HookPosition) -> UpdateHook {
|
||||
pub fn new(storepath: &'a PathBuf, p: HookPosition) -> UpdateHook<'a> {
|
||||
UpdateHook {
|
||||
storepath: storepath,
|
||||
position: p,
|
||||
config: None,
|
||||
}
|
||||
|
@ -24,7 +29,7 @@ impl UpdateHook {
|
|||
|
||||
}
|
||||
|
||||
impl Hook for UpdateHook {
|
||||
impl<'a> Hook for UpdateHook<'a> {
|
||||
|
||||
fn name(&self) -> &'static str {
|
||||
"stdhook_git_update"
|
||||
|
@ -36,14 +41,14 @@ impl Hook for UpdateHook {
|
|||
|
||||
}
|
||||
|
||||
impl HookDataAccessorProvider for UpdateHook {
|
||||
impl<'a> HookDataAccessorProvider for UpdateHook<'a> {
|
||||
|
||||
fn accessor(&self) -> HookDataAccessor {
|
||||
HookDataAccessor::StoreIdAccess(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl StoreIdAccessor for UpdateHook {
|
||||
impl<'a> StoreIdAccessor for UpdateHook<'a> {
|
||||
|
||||
fn access(&self, id: &StoreId) -> HookResult<()> {
|
||||
debug!("[GIT UPDATE HOOK]: {:?}", id);
|
||||
|
|
Loading…
Reference in a new issue