support custom core.hooksPath

This commit is contained in:
uri 2021-08-28 01:35:03 +03:00
parent 40e21bb8ba
commit 1c8fe57b66
3 changed files with 37 additions and 11 deletions

View file

@ -6,6 +6,7 @@ from typing import List
from typing import MutableMapping
from typing import Optional
from typing import Set
from typing import Tuple
from pre_commit.errors import FatalError
from pre_commit.util import CalledProcessError
@ -176,9 +177,9 @@ def has_diff(*args: str, repo: str = '.') -> bool:
return cmd_output_b(*cmd, cwd=repo, retcode=None)[0] == 1
def has_core_hookpaths_set() -> bool:
def has_core_hookpaths_set() -> Tuple[bool, str]:
_, out, _ = cmd_output_b('git', 'config', 'core.hooksPath', retcode=None)
return bool(out.strip())
return bool(out.strip()), out.strip().decode()
def init_repo(path: str, remote: str) -> None: