diff --git a/libimagstorestdhook/src/vcs/git/delete.rs b/libimagstorestdhook/src/vcs/git/delete.rs index 902e5096..ccb38b4f 100644 --- a/libimagstorestdhook/src/vcs/git/delete.rs +++ b/libimagstorestdhook/src/vcs/git/delete.rs @@ -9,21 +9,26 @@ use libimagstore::hook::position::HookPosition; use libimagstore::hook::accessor::{HookDataAccessor, HookDataAccessorProvider}; use libimagstore::hook::accessor::StoreIdAccessor; +use vcs::git::error::GitHookErrorKind as GHEK; +use vcs::git::error::MapErrInto; +use vcs::git::runtime::Runtime as GRuntime; + #[derive(Debug)] pub struct DeleteHook { storepath: PathBuf, + runtime: GRuntime, + position: HookPosition, - config: Option, } impl DeleteHook { pub fn new(storepath: PathBuf, p: HookPosition) -> DeleteHook { DeleteHook { + runtime: GRuntime::new(&storepath), storepath: storepath, position: p, - config: None, } } @@ -35,8 +40,16 @@ impl Hook for DeleteHook { "stdhook_git_delete" } + /// Set the configuration of the hook. See + /// `libimagstorestdhook::vcs::git::runtime::Runtime::set_config()`. + /// + /// This function traces the error (using `trace_error()`) that + /// `libimagstorestdhook::vcs::git::runtime::Runtime::set_config()` + /// returns, if any. fn set_config(&mut self, config: &Value) { - self.config = Some(config.clone()); + if let Err(e) = self.runtime.set_config(config) { + trace_error(&e); + } } }