From 06c814d6e94fee466293507e9e3eb717dcf9da55 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 20 Sep 2016 10:27:48 +0200 Subject: [PATCH] Revert "Add helper fn to check whether the repository WD is dirty" This reverts commit eb378d47c2c37e04f5c4130aec023142212c6abe. --- libimagstorestdhook/src/vcs/git/runtime.rs | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/libimagstorestdhook/src/vcs/git/runtime.rs b/libimagstorestdhook/src/vcs/git/runtime.rs index 0fb26326..76895935 100644 --- a/libimagstorestdhook/src/vcs/git/runtime.rs +++ b/libimagstorestdhook/src/vcs/git/runtime.rs @@ -1,6 +1,6 @@ use std::path::PathBuf; -use git2::{Index, Repository}; +use git2::Repository; use toml::Value; use libimagerror::into::IntoError; @@ -155,25 +155,5 @@ impl Runtime { .map_dbg(|_| format!("[GIT {} HOOK]: Branch checked out", action.uppercase())) } - /// Check whether the WD is "dirty" - whether there is a diff to the repository - /// This function returns false if there is no `Repository` object in the `Runtime` - pub fn repo_is_dirty(&self, index: &Index) -> bool { - match self.repository.as_ref() { - Some(repo) => { - repo.diff_index_to_workdir(Some(index), None) - .map_dbg_str("Fetched diff: Index <-> WD") - .map_dbg_err_str("Failed to fetch diff: Index <-> WD") - .map(|diff| diff.deltas().count() != 0) - .unwrap_or(false) - }, - - None => { - debug!("No repository: Cannot fetch diff: Index <-> WD"); - false - } - } - - } - }