Merging upstream version 2.16.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
2b79a68a34
commit
ada93679f9
34 changed files with 301 additions and 126 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue