From f4a71831c9475a5529afc2a2af773e636a084a81 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 16 Jul 2016 15:59:53 +0200 Subject: [PATCH] Add store path member for delete hook --- libimagstorestdhook/src/vcs/git/delete.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/libimagstorestdhook/src/vcs/git/delete.rs b/libimagstorestdhook/src/vcs/git/delete.rs index 38f3bac1..fd476b21 100644 --- a/libimagstorestdhook/src/vcs/git/delete.rs +++ b/libimagstorestdhook/src/vcs/git/delete.rs @@ -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 DeleteHook { +pub struct DeleteHook<'a> { + storepath: &'a PathBuf, + position: HookPosition, config: Option, } -impl DeleteHook { +impl<'a> DeleteHook<'a> { - pub fn new(p: HookPosition) -> DeleteHook { + pub fn new(storepath: &'a PathBuf, p: HookPosition) -> DeleteHook<'a> { DeleteHook { + storepath: storepath, position: p, config: None, } @@ -24,7 +29,7 @@ impl DeleteHook { } -impl Hook for DeleteHook { +impl<'a> Hook for DeleteHook<'a> { fn name(&self) -> &'static str { "stdhook_git_delete" @@ -36,14 +41,14 @@ impl Hook for DeleteHook { } -impl HookDataAccessorProvider for DeleteHook { +impl<'a> HookDataAccessorProvider for DeleteHook<'a> { fn accessor(&self) -> HookDataAccessor { HookDataAccessor::StoreIdAccess(self) } } -impl StoreIdAccessor for DeleteHook { +impl<'a> StoreIdAccessor for DeleteHook<'a> { fn access(&self, id: &StoreId) -> HookResult<()> { debug!("[GIT DELETE HOOK]: {:?}", id);