Adapt ensure_cfg_branch_is_checked_out() for new Runtime::repository() interface
This commit is contained in:
parent
b50aacbf55
commit
c19f269f59
2 changed files with 6 additions and 6 deletions
|
@ -103,11 +103,9 @@ impl StoreIdAccessor for CreateHook {
|
||||||
.map_into_hook_error()
|
.map_into_hook_error()
|
||||||
);
|
);
|
||||||
|
|
||||||
debug!("[GIT CREATE HOOK]: Ensuring branch checkout");
|
|
||||||
try!(self.runtime.ensure_cfg_branch_is_checked_out());
|
|
||||||
debug!("[GIT CREATE HOOK]: Branch checked out");
|
|
||||||
|
|
||||||
let action = StoreAction::Create;
|
let action = StoreAction::Create;
|
||||||
|
try!(self.runtime.ensure_cfg_branch_is_checked_out(&action));
|
||||||
|
|
||||||
let cfg = try!(self.runtime.config_value_or_err(&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));
|
||||||
|
|
|
@ -74,11 +74,12 @@ impl Runtime {
|
||||||
.map_dbg(|_| format!("[GIT {} HOOK]: Repository object fetched", action.uppercase()))
|
.map_dbg(|_| format!("[GIT {} HOOK]: Repository object fetched", action.uppercase()))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ensure_cfg_branch_is_checked_out(&self) -> HookResult<()> {
|
pub fn ensure_cfg_branch_is_checked_out(&self, action: &StoreAction) -> HookResult<()> {
|
||||||
use vcs::git::config::ensure_branch;
|
use vcs::git::config::ensure_branch;
|
||||||
|
|
||||||
|
debug!("[GIT CREATE HOOK]: Ensuring branch checkout");
|
||||||
let head = try!(self
|
let head = try!(self
|
||||||
.repository()
|
.repository(action)
|
||||||
.and_then(|r| {
|
.and_then(|r| {
|
||||||
debug!("Repository fetched, getting head");
|
debug!("Repository fetched, getting head");
|
||||||
r.head()
|
r.head()
|
||||||
|
@ -128,6 +129,7 @@ impl Runtime {
|
||||||
}
|
}
|
||||||
.map_err(Box::new)
|
.map_err(Box::new)
|
||||||
.map_err(|e| HEK::HookExecutionError.into_error_with_cause(e))
|
.map_err(|e| HEK::HookExecutionError.into_error_with_cause(e))
|
||||||
|
.map_dbg_str("[GIT CREATE HOOK]: Branch checked out")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue