Check whether committing is enabled before doing so
This commit is contained in:
parent
5b7ff231a9
commit
be323a641e
2 changed files with 12 additions and 0 deletions
|
@ -105,6 +105,7 @@ impl StoreIdAccessor for DeleteHook {
|
|||
use vcs::git::util::fetch_index;
|
||||
use vcs::git::config::abort_on_repo_init_err;
|
||||
use vcs::git::config::is_enabled;
|
||||
use vcs::git::config::committing_is_enabled;
|
||||
use git2::{ADD_DEFAULT, STATUS_WT_DELETED, IndexMatchedPath};
|
||||
|
||||
debug!("[GIT DELETE HOOK]: {:?}", id);
|
||||
|
@ -189,6 +190,11 @@ impl StoreIdAccessor for DeleteHook {
|
|||
.map_into_hook_error()
|
||||
);
|
||||
|
||||
if !try!(committing_is_enabled(cfg)) {
|
||||
debug!("Committing not enabled. This is fine, returning now...");
|
||||
return Ok(())
|
||||
}
|
||||
|
||||
let mut parents = Vec::new();
|
||||
{
|
||||
let commit = try!(
|
||||
|
|
|
@ -119,6 +119,7 @@ impl StoreIdAccessor for UpdateHook {
|
|||
use vcs::git::util::fetch_index;
|
||||
use vcs::git::config::abort_on_repo_init_err;
|
||||
use vcs::git::config::is_enabled;
|
||||
use vcs::git::config::committing_is_enabled;
|
||||
use git2::{ADD_DEFAULT, STATUS_WT_NEW, STATUS_WT_MODIFIED, IndexMatchedPath};
|
||||
|
||||
debug!("[GIT UPDATE HOOK]: {:?}", id);
|
||||
|
@ -212,6 +213,11 @@ impl StoreIdAccessor for UpdateHook {
|
|||
.map_into_hook_error()
|
||||
);
|
||||
|
||||
if !try!(committing_is_enabled(cfg)) {
|
||||
debug!("Committing not enabled. This is fine, returning now...");
|
||||
return Ok(())
|
||||
}
|
||||
|
||||
let mut parents = Vec::new();
|
||||
{
|
||||
let commit = try!(
|
||||
|
|
Loading…
Reference in a new issue