An unexpected error has occurred: CalledProcessError: Command: ('/usr/bin/git', 'add', '-u')
Return code: 128
Expected return code: 0
Output: (none)
Errors:
fatal: this operation must be run in a work tree
Traceback (most recent call last):
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pre_commit/error_handler.py", line 46, in error_handler
yield
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pre_commit/main.py", line 296, in main
return try_repo(args)
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pre_commit/commands/try_repo.py", line 55, in try_repo
repo, ref = _repo_ref(tempdir, args.repo, args.ref)
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pre_commit/commands/try_repo.py", line 45, in _repo_ref
cmd_output('git', 'add', '-u', cwd=repo, env=env)
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pre_commit/util.py", line 153, in cmd_output
returncode, cmd, retcode, output=(stdout, stderr),
pre_commit.util.CalledProcessError: Command: ('/usr/bin/git', 'add', '-u')
Return code: 128
Expected return code: 0
Output: (none)
Errors:
fatal: this operation must be run in a work tree
Given a repo with
.pre-commit-hooks.yamldefined (like https://github.com/ansible/ansible-lint), I want to integrate testing of the hooks declared in it.I can do
pre-commit try-repo https://github.com/ansible/ansible-lint.gitbut this hits the remote which I want to avoid. I know that Git itself can work with local fs paths (like/path/to/.git) perfectly fine.So I tried:
$ pre-commit try-repo .git -vvvThe log doesn't reveal anything more than the fact that the Git command failed.
$ cat ~/.cache/pre-commit/pre-commit.logIt must be pretty easy to fix.