Add debug output in UpdateHook::access()
This commit is contained in:
parent
3252f9b751
commit
a4231ac5d8
1 changed files with 22 additions and 11 deletions
|
@ -103,30 +103,29 @@ impl StoreIdAccessor for UpdateHook {
|
||||||
id.clone()
|
id.clone()
|
||||||
.into_pathbuf()
|
.into_pathbuf()
|
||||||
.map_err_into(GHEK::StoreIdHandlingError)
|
.map_err_into(GHEK::StoreIdHandlingError)
|
||||||
.map_into_hook_error()
|
.map_dbg_err_str("Failed to StoreId.into_pathbuf()")
|
||||||
);
|
|
||||||
|
|
||||||
let tree_id = try!(
|
|
||||||
index.write_tree()
|
|
||||||
.map_err_into(GHEK::RepositoryIndexWritingError)
|
|
||||||
.map_into_hook_error()
|
.map_into_hook_error()
|
||||||
);
|
);
|
||||||
|
|
||||||
let signature = try!(
|
let signature = try!(
|
||||||
repo.signature()
|
repo.signature()
|
||||||
.map_err_into(GHEK::MkSignature)
|
.map_err_into(GHEK::MkSignature)
|
||||||
|
.map_dbg_err_str("Failed to fetch signature")
|
||||||
.map_into_hook_error()
|
.map_into_hook_error()
|
||||||
);
|
);
|
||||||
|
|
||||||
let head = try!(
|
let head = try!(
|
||||||
repo.head()
|
repo.head()
|
||||||
.map_err_into(GHEK::HeadFetchError)
|
.map_err_into(GHEK::HeadFetchError)
|
||||||
|
.map_dbg_err_str("Failed to fetch HEAD")
|
||||||
.map_into_hook_error()
|
.map_into_hook_error()
|
||||||
);
|
);
|
||||||
|
|
||||||
let file_status = try!(
|
let file_status = try!(
|
||||||
repo
|
repo
|
||||||
.status_file(&path)
|
.status_file(&path)
|
||||||
|
.map_dbg_err_str("Failed to fetch file status")
|
||||||
|
.map_dbg_err(|e| format!("\t-> {:?}", e))
|
||||||
.map_err_into(GHEK::RepositoryFileStatusError)
|
.map_err_into(GHEK::RepositoryFileStatusError)
|
||||||
.map_into_hook_error()
|
.map_into_hook_error()
|
||||||
);
|
);
|
||||||
|
@ -144,6 +143,7 @@ impl StoreIdAccessor for UpdateHook {
|
||||||
try!(
|
try!(
|
||||||
index.add_all(&[path], ADD_DEFAULT, Some(cb as &mut IndexMatchedPath))
|
index.add_all(&[path], ADD_DEFAULT, Some(cb as &mut IndexMatchedPath))
|
||||||
.map_err_into(GHEK::RepositoryPathAddingError)
|
.map_err_into(GHEK::RepositoryPathAddingError)
|
||||||
|
.map_dbg_err_str("Failed to add to index")
|
||||||
.map_into_hook_error()
|
.map_into_hook_error()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -152,6 +152,7 @@ impl StoreIdAccessor for UpdateHook {
|
||||||
let commit = try!(
|
let commit = try!(
|
||||||
repo.find_commit(head.target().unwrap())
|
repo.find_commit(head.target().unwrap())
|
||||||
.map_err_into(GHEK::RepositoryParentFetchingError)
|
.map_err_into(GHEK::RepositoryParentFetchingError)
|
||||||
|
.map_dbg_err_str("Failed to find commit HEAD")
|
||||||
.map_into_hook_error()
|
.map_into_hook_error()
|
||||||
);
|
);
|
||||||
parents.push(commit);
|
parents.push(commit);
|
||||||
|
@ -160,19 +161,29 @@ impl StoreIdAccessor for UpdateHook {
|
||||||
// for converting from Vec<Commit> to Vec<&Commit>
|
// for converting from Vec<Commit> to Vec<&Commit>
|
||||||
let parents = parents.iter().collect::<Vec<_>>();
|
let parents = parents.iter().collect::<Vec<_>>();
|
||||||
|
|
||||||
let tree = try!(
|
let tree_id = try!(
|
||||||
repo.find_tree(tree_id)
|
index.write_tree()
|
||||||
.map_err_into(GHEK::RepositoryParentFetchingError)
|
.map_err_into(GHEK::RepositoryIndexWritingError)
|
||||||
|
.map_dbg_err_str("Failed to write tree")
|
||||||
.map_into_hook_error()
|
.map_into_hook_error()
|
||||||
);
|
);
|
||||||
|
|
||||||
let message = try!(commit_message(cfg, StoreAction::Update));
|
|
||||||
|
let tree = try!(
|
||||||
|
repo.find_tree(tree_id)
|
||||||
|
.map_err_into(GHEK::RepositoryParentFetchingError)
|
||||||
|
.map_dbg_err_str("Failed to find tree")
|
||||||
|
.map_into_hook_error()
|
||||||
|
);
|
||||||
|
|
||||||
|
let message = try!(commit_message(cfg, StoreAction::Update)
|
||||||
|
.map_dbg_err_str("Failed to get commit message"));
|
||||||
|
|
||||||
repo.commit(Some("HEAD"), &signature, &signature, &message, &tree, &parents)
|
repo.commit(Some("HEAD"), &signature, &signature, &message, &tree, &parents)
|
||||||
|
.map_dbg_err_str("Failed to commit")
|
||||||
.map_err_into(GHEK::RepositoryCommittingError)
|
.map_err_into(GHEK::RepositoryCommittingError)
|
||||||
.map_into_hook_error()
|
.map_into_hook_error()
|
||||||
.map(|_| ())
|
.map(|_| ())
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue