Fix tip commit helper function

This commit is contained in:
Patrick Lühne 2019-03-02 00:58:07 +01:00
parent 2566dc07fc
commit e454558faa
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF

View File

@ -396,13 +396,7 @@ impl BenchmarkRepository
fn tip_commit<'repository>(repository: &'repository git2::Repository, branch_name: &str) -> Result<git2::Commit<'repository>, git2::Error>
{
let tip_reference_name = format!("refs/remotes/origin/{}", branch_name);
let tip_reference = match repository.find_reference(&tip_reference_name)
{
Ok(value) => value,
Err(error) => panic!("Could not find reference “{}”: {}", tip_reference_name, error),
};
tip_reference.peel_to_commit()
repository.find_reference(&tip_reference_name).and_then(|tip_reference| tip_reference.peel_to_commit())
}
pub fn join(&self)