DeleteHook: return Ok(()) if disabled
This commit is contained in:
parent
d115e4ca8e
commit
fbd195db25
1 changed files with 6 additions and 1 deletions
|
@ -85,11 +85,17 @@ impl StoreIdAccessor for DeleteHook {
|
||||||
use vcs::git::error::MapIntoHookError;
|
use vcs::git::error::MapIntoHookError;
|
||||||
use vcs::git::util::fetch_index;
|
use vcs::git::util::fetch_index;
|
||||||
use vcs::git::config::abort_on_repo_init_err;
|
use vcs::git::config::abort_on_repo_init_err;
|
||||||
|
use vcs::git::config::is_enabled;
|
||||||
use git2::{ADD_DEFAULT, STATUS_WT_DELETED, IndexMatchedPath};
|
use git2::{ADD_DEFAULT, STATUS_WT_DELETED, IndexMatchedPath};
|
||||||
|
|
||||||
debug!("[GIT DELETE HOOK]: {:?}", id);
|
debug!("[GIT DELETE HOOK]: {:?}", id);
|
||||||
|
|
||||||
let action = StoreAction::Delete;
|
let action = StoreAction::Delete;
|
||||||
|
let cfg = try!(self.runtime.config_value_or_err(&action));
|
||||||
|
|
||||||
|
if !is_enabled(cfg) {
|
||||||
|
return Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
if !self.runtime.has_repository() {
|
if !self.runtime.has_repository() {
|
||||||
debug!("[GIT DELETE HOOK]: Runtime has no repository...");
|
debug!("[GIT DELETE HOOK]: Runtime has no repository...");
|
||||||
|
@ -108,7 +114,6 @@ impl StoreIdAccessor for DeleteHook {
|
||||||
}
|
}
|
||||||
|
|
||||||
let _ = try!(self.runtime.ensure_cfg_branch_is_checked_out(&action));
|
let _ = try!(self.runtime.ensure_cfg_branch_is_checked_out(&action));
|
||||||
let cfg = try!(self.runtime.config_value_or_err(&action));
|
|
||||||
let repo = try!(self.runtime.repository(&action));
|
let repo = try!(self.runtime.repository(&action));
|
||||||
let mut index = try!(fetch_index(repo, &action));
|
let mut index = try!(fetch_index(repo, &action));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue