[TMP]
This commit is contained in:
parent
3a6f469b7d
commit
3f43fa1172
1 changed files with 33 additions and 32 deletions
|
@ -114,49 +114,50 @@ impl StoreIdAccessor for CreateHook {
|
||||||
})
|
})
|
||||||
.and_then(|(repo, cfg, sig)| {
|
.and_then(|(repo, cfg, sig)| {
|
||||||
repo.index()
|
repo.index()
|
||||||
.map(|idx| (repo, cfg, sig, idx))
|
|
||||||
.map_dbg_err_str("[GIT CREATE HOOK]: Couldn't fetch Index")
|
.map_dbg_err_str("[GIT CREATE HOOK]: Couldn't fetch Index")
|
||||||
|
.and_then(|mut idx| idx.write_tree().map(|t| (idx, t)))
|
||||||
|
.map_dbg_err_str("[GIT CREATE HOOK]: Couldn't write Tree")
|
||||||
|
.and_then(|(idx, tree_id)| repo.find_tree(tree_id).map(|t| (idx, t)))
|
||||||
|
.map_dbg_err_str("[GIT CREATE HOOK]: Couldn't find Tree")
|
||||||
|
.map(|(idx, tree)| (repo, cfg, sig, idx, tree))
|
||||||
.map_err_into(GHEK::RepositoryIndexFetchingError)
|
.map_err_into(GHEK::RepositoryIndexFetchingError)
|
||||||
.map_err_into(GHEK::RepositoryError)
|
.map_err_into(GHEK::RepositoryError)
|
||||||
.map_err(|e| e.into())
|
.map_err(|e| e.into())
|
||||||
})
|
})
|
||||||
.and_then(|(repo, cfg, sig, mut idx)| {
|
.and_then(|(repo, cfg, sig, mut idx, tree)| {
|
||||||
id.strip_prefix(&self.storepath)
|
idx.add_path(id)
|
||||||
.map_err_into(GHEK::StoreIdStripError)
|
.map(|_| (repo, cfg, sig, idx, tree))
|
||||||
.and_then(|id| idx.add_path(&id).map_err_into(GHEK::RepositoryPathAddingError))
|
.map_dbg_err_str("[GIT CREATE HOOK]: Couldn't add Path")
|
||||||
.map(|_| (repo, cfg, sig, idx))
|
.map_dbg_err(|_| format!("\tpath = {:?}", id))
|
||||||
.map_err_into(GHEK::RepositoryError)
|
.map_dbg_err(|e| format!("\terr = {:?}", e))
|
||||||
.map_dbg_err_str("[GIT CREATE HOOK]: Couldn't add Path: {:?}")
|
.map_err_into(GHEK::RepositoryPathAddingError)
|
||||||
.map_err(|e| e.into())
|
|
||||||
})
|
|
||||||
.and_then(|(repo, cfg, sig, mut idx)| {
|
|
||||||
idx.write_tree()
|
|
||||||
.map(|oid| (repo, cfg, sig, idx, oid))
|
|
||||||
.map_dbg_err_str("[GIT CREATE HOOK]: Couldn't write Tree")
|
|
||||||
.map_err_into(GHEK::RepositoryTreeWritingError)
|
|
||||||
.map_err_into(GHEK::RepositoryError)
|
.map_err_into(GHEK::RepositoryError)
|
||||||
.map_err(|e| e.into())
|
.map_err(|e| e.into())
|
||||||
})
|
})
|
||||||
.and_then(|(repo, cfg, sig, idx, oid)| {
|
.and_then(|(repo, cfg, sig, idx, tree)| {
|
||||||
repo.find_tree(oid)
|
repo.head()
|
||||||
.map(|tree| (repo, cfg, sig, idx, oid, tree))
|
.map_dbg_err_str("[GIT CREATE HOOK]: Couldn't fetch HEAD")
|
||||||
.map_dbg_err_str("[GIT CREATE HOOK]: Couldn't find Tree")
|
.map_err_into(GHEK::RepositoryHeadFetchingError)
|
||||||
.map_err_into(GHEK::RepositoryTreeFindingError)
|
.and_then(|h| {
|
||||||
|
h.target().ok_or(GHEK::RepositoryHeadTargetFetchingError.into_error())
|
||||||
|
})
|
||||||
|
.and_then(|oid| {
|
||||||
|
repo.find_commit(oid)
|
||||||
|
.map_dbg_err_str("[GIT CREATE HOOK]: Couldn't find commit")
|
||||||
|
.map_dbg_err(|_| format!("\toid = {:?}", oid))
|
||||||
|
.map_err_into(GHEK::RepositoryCommitFindingError)
|
||||||
|
})
|
||||||
.map_err_into(GHEK::RepositoryError)
|
.map_err_into(GHEK::RepositoryError)
|
||||||
.map_err(|e| e.into())
|
.map_err(|e| e.into())
|
||||||
|
.map(|parent| (repo, cfg, sig, idx, tree, parent))
|
||||||
})
|
})
|
||||||
.and_then(|(repo, cfg, sig, idx, oid, tree)| {
|
.and_then(|(repo, cfg, sig, idx, tree, parent)| {
|
||||||
let cmtmsg = commit_message(cfg, StoreAction::Create);
|
let mut parents = vec![];
|
||||||
repo.find_commit(oid)
|
parents.push(parent);
|
||||||
.map(|cmt| (repo, sig, tree, cmt, cmtmsg))
|
let parents = parents.iter().collect::<Vec<_>>();
|
||||||
.map_dbg_err_str("[GIT CREATE HOOK]: Couldn't find Commit")
|
let msg = commit_message(&cfg, StoreAction::Create);
|
||||||
.map_err_into(GHEK::RepositoryCommitFindingError)
|
repo.commit(Some("HEAD"), &sig, &sig, &msg[..], &tree, &parents)
|
||||||
.map_err_into(GHEK::RepositoryError)
|
.map_dbg_err_str("[GIT CREATE HOOK]: Couldn't commit")
|
||||||
.map_err(|e| e.into())
|
|
||||||
})
|
|
||||||
.and_then(|(repo, sig, tree, cmt, commitmsg)| {
|
|
||||||
repo.commit(Some("HEAD"), &sig, &sig, &commitmsg[..], &tree, &[&cmt])
|
|
||||||
.map_dbg_err_str("[GIT CREATE HOOK]: Couldn't create Commit")
|
|
||||||
.map_err_into(GHEK::RepositoryCommittingError)
|
.map_err_into(GHEK::RepositoryCommittingError)
|
||||||
.map_err_into(GHEK::RepositoryError)
|
.map_err_into(GHEK::RepositoryError)
|
||||||
.map_err(|e| e.into())
|
.map_err(|e| e.into())
|
||||||
|
|
Loading…
Reference in a new issue