diff --git a/libimagstorestdhook/src/vcs/git/create.rs b/libimagstorestdhook/src/vcs/git/create.rs index d3df670d..079b1b60 100644 --- a/libimagstorestdhook/src/vcs/git/create.rs +++ b/libimagstorestdhook/src/vcs/git/create.rs @@ -113,11 +113,9 @@ impl StoreIdAccessor for CreateHook { try!(self.runtime.ensure_cfg_branch_is_checked_out()); debug!("[GIT CREATE HOOK]: Branch checked out"); - let repo = try!(fetch_repo(&self.runtime, - "[GIT CREATE HOOK]: Getting repository", - "[GIT CREATE HOOK]: Couldn't fetch Repository", - "[GIT CREATE HOOK]: Repository object fetched") - ); + let action = StoreAction::Create; + + let repo = try!(fetch_repo(&self.runtime, &action)); let mut index = try!( repo diff --git a/libimagstorestdhook/src/vcs/git/update.rs b/libimagstorestdhook/src/vcs/git/update.rs index e423c0de..1c91fa78 100644 --- a/libimagstorestdhook/src/vcs/git/update.rs +++ b/libimagstorestdhook/src/vcs/git/update.rs @@ -97,11 +97,9 @@ impl StoreIdAccessor for UpdateHook { .map_dbg_err_str("[GIT UPDATE HOOK]: Couldn't get Value object from config") ); - let repo = try!(fetch_repo(&self.runtime, - "[GIT UPDATE HOOK]: Getting repository", - "[GIT UPDATE HOOK]: Couldn't fetch Repository", - "[GIT UPDATE HOOK]: Repository object fetched") - ); + let action = StoreAction::Update; + + let repo = try!(fetch_repo(&self.runtime, &action)); let mut index = try!( repo diff --git a/libimagstorestdhook/src/vcs/git/util.rs b/libimagstorestdhook/src/vcs/git/util.rs index a87fc6dd..6bdd954d 100644 --- a/libimagstorestdhook/src/vcs/git/util.rs +++ b/libimagstorestdhook/src/vcs/git/util.rs @@ -15,9 +15,11 @@ use libimagstore::hook::error::HookError; pub fn fetch_repo<'a>(runtime: &'a GRuntime, action: &StoreAction) -> Result<&'a Repository, HookError> { + debug!("[GIT {} HOOK]: Getting repository", action.uppercase()); runtime .repository() - .map_dbg_err_str(on_err_str) + .map_dbg_err(|_| format!("[GIT {} HOOK]: Couldn't fetch Repository", action.uppercase())) + .map_dbg(|_| format!("[GIT {} HOOK]: Repository object fetched", action.uppercase())) .map_err_into(GHEK::RepositoryError) .map_into_hook_error() }