From 068c7318579c0a515aa7a063fd3253aa75b404e7 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 26 Jul 2016 14:40:46 +0200 Subject: [PATCH] Remove author/committer fetching, the git2 crate can do this --- libimagstorestdhook/src/vcs/git/runtime.rs | 32 ++-------------------- 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/libimagstorestdhook/src/vcs/git/runtime.rs b/libimagstorestdhook/src/vcs/git/runtime.rs index 674870dd..49771d7e 100644 --- a/libimagstorestdhook/src/vcs/git/runtime.rs +++ b/libimagstorestdhook/src/vcs/git/runtime.rs @@ -11,24 +11,9 @@ use libimagstore::hook::result::HookResult; use vcs::git::result::Result; use vcs::git::error::{MapErrInto, GitHookErrorKind as GHEK}; -use vcs::git::config::{author_name, author_mail, committer_name, committer_mail}; - -struct Person<'a> { - pub name: &'a str, - pub mail: &'a str, -} - -impl<'a> Person<'a> { - fn new(name: &'a str, mail: &'a str) -> Person<'a> { - Person { name: name, mail: mail } - } -} pub struct Runtime<'a> { repository: Option, - author: Option>, - committer: Option>, - config: Option, } @@ -44,26 +29,13 @@ impl<'a> Runtime<'a> { }, }, - author: None, - committer: None, config: None, } } pub fn set_config(&mut self, cfg: &Value) -> Result<()> { - let config = cfg.clone(); - let res = author_name(&config) - .and_then(|n| author_mail(&config).map(|m| Person::new(n, m))) - .and_then(|author| { - committer_name(&config) - .and_then(|n| committer_mail(&config).map(|m| (author, Person::new(n, m)))) - }) - .map(|(author, committer)| { - self.author = Some(author); - self.committer = Some(committer); - }); - self.config = Some(config); - res + self.config = Some(cfg.clone()); + Ok(()) } pub fn has_repository(&self) -> bool {