diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-12-04 03:57:54 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-12-04 03:57:54 +0000 |
commit | fc1651ef0b7ccedc604b28d5893f5cd486cd4091 (patch) | |
tree | 3ea033abb546734a46b2e947756e0d9f792b0e80 /pre_commit/git.py | |
parent | Releasing debian version 2.15.0-1. (diff) | |
download | pre-commit-fc1651ef0b7ccedc604b28d5893f5cd486cd4091.tar.xz pre-commit-fc1651ef0b7ccedc604b28d5893f5cd486cd4091.zip |
Merging upstream version 2.16.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pre_commit/git.py')
-rw-r--r-- | pre_commit/git.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/pre_commit/git.py b/pre_commit/git.py index 6264529..e9ec601 100644 --- a/pre_commit/git.py +++ b/pre_commit/git.py @@ -12,9 +12,11 @@ from pre_commit.util import CalledProcessError from pre_commit.util import cmd_output from pre_commit.util import cmd_output_b - logger = logging.getLogger(__name__) +# see #2046 +NO_FS_MONITOR = ('-c', 'core.useBuiltinFSMonitor=false') + def zsplit(s: str) -> List[str]: s = s.strip('\0') @@ -39,9 +41,10 @@ def no_git_env( return { k: v for k, v in _env.items() if not k.startswith('GIT_') or + k.startswith(('GIT_CONFIG_KEY_', 'GIT_CONFIG_VALUE_')) or k in { 'GIT_EXEC_PATH', 'GIT_SSH', 'GIT_SSH_COMMAND', 'GIT_SSL_CAINFO', - 'GIT_SSL_NO_VERIFY', + 'GIT_SSL_NO_VERIFY', 'GIT_CONFIG_COUNT', } } @@ -185,10 +188,11 @@ def init_repo(path: str, remote: str) -> None: if os.path.isdir(remote): remote = os.path.abspath(remote) + git = ('git', *NO_FS_MONITOR) env = no_git_env() # avoid the user's template so that hooks do not recurse - cmd_output_b('git', 'init', '--template=', path, env=env) - cmd_output_b('git', 'remote', 'add', 'origin', remote, cwd=path, env=env) + cmd_output_b(*git, 'init', '--template=', path, env=env) + cmd_output_b(*git, 'remote', 'add', 'origin', remote, cwd=path, env=env) def commit(repo: str = '.') -> None: |