experiments: commit with --no-verify in executors (#5078)

* git: add no_verify flag for commit()

* experiments: commit with --no-verify in executors

* git: wrap hook exceptions with SCMError

* update hook file perms

* update dulwich to 0.20.15

* update pygit2 commit def

* skip hook tests on windows
This commit is contained in:
Peter Rowlands (변기호)
2020-12-28 17:35:35 +09:00
committed by GitHub
parent fa4bf40eb4
commit 7a92ff5e5d
7 changed files with 37 additions and 8 deletions
+7 -2
View File
@@ -200,8 +200,13 @@ class GitPythonBackend(BaseGitBackend): # pylint:disable=abstract-method
logger.exception(msg)
def commit(self, msg: str):
self.repo.index.commit(msg)
def commit(self, msg: str, no_verify: bool = False):
from git.exc import HookExecutionError
try:
self.repo.index.commit(msg, skip_hooks=no_verify)
except HookExecutionError as exc:
raise SCMError("Git pre-commit hook failed") from exc
def checkout(
self, branch: str, create_new: Optional[bool] = False, **kwargs