Fix debug messages in Runtime::ensure_cfg_branch_is_checked_out()

This commit is contained in:
Matthias Beyer 2016-09-18 18:34:01 +02:00
parent a4cdb2b873
commit 4a0def0ede

View file

@ -92,40 +92,40 @@ impl Runtime {
pub fn ensure_cfg_branch_is_checked_out(&self, action: &StoreAction) -> 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"); debug!("[GIT {} HOOK]: Ensuring branch checkout", action.uppercase());
let head = try!(self let head = try!(self
.repository(action) .repository(action)
.and_then(|r| { .and_then(|r| {
debug!("Repository fetched, getting head"); debug!("[GIT {} HOOK]: Repository fetched, getting head", action.uppercase());
r.head() r.head()
.map_dbg_err_str("Couldn't fetch HEAD") .map_dbg_err_str("Couldn't fetch HEAD")
.map_dbg_err(|e| format!("\tbecause = {:?}", e)) .map_dbg_err(|e| format!("\tbecause = {:?}", e))
.map_err_into(GHEK::HeadFetchError) .map_err_into(GHEK::HeadFetchError)
.map_err(|e| e.into()) .map_err(|e| e.into())
})); }));
debug!("HEAD fetched"); debug!("[GIT {} HOOK]: HEAD fetched", action.uppercase());
// TODO: Fail if not on branch? hmmh... I'm not sure // TODO: Fail if not on branch? hmmh... I'm not sure
if !head.is_branch() { if !head.is_branch() {
debug!("HEAD is not a branch"); debug!("[GIT {} HOOK]: HEAD is not a branch", action.uppercase());
return Err(GHEK::NotOnBranch.into_error().into()); return Err(GHEK::NotOnBranch.into_error().into());
} }
debug!("HEAD is a branch"); debug!("[GIT {} HOOK]: HEAD is a branch", action.uppercase());
// Check out appropriate branch ... or fail // Check out appropriate branch ... or fail
match ensure_branch(self.config.as_ref()) { match ensure_branch(self.config.as_ref()) {
Ok(Some(s)) => { Ok(Some(s)) => {
debug!("We have to ensure branch: {}", s); debug!("[GIT {} HOOK]: We have to ensure branch: {}", action.uppercase(), s);
match head.name().map(|name| { match head.name().map(|name| {
debug!("{} == {}", name, s); debug!("[GIT {} HOOK]: {} == {}", action.uppercase(), name, s);
name == s name == s
}) { }) {
Some(b) => { Some(b) => {
if b { if b {
debug!("Branch already checked out."); debug!("[GIT {} HOOK]: Branch already checked out.", action.uppercase());
Ok(()) Ok(())
} else { } else {
debug!("Branch not checked out."); debug!("[GIT {} HOOK]: Branch not checked out.", action.uppercase());
unimplemented!() unimplemented!()
} }
}, },
@ -136,7 +136,7 @@ impl Runtime {
} }
}, },
Ok(None) => { Ok(None) => {
debug!("No branch to checkout"); debug!("[GIT {} HOOK]: No branch to checkout", action.uppercase());
Ok(()) Ok(())
}, },