Skip to content

Cloning repo inside pre-commit fails with latest git #300

Description

@asottile

Seems to be a regression in git between 2.5 and 2.6 -- I can work around this however.

$ python -m pytest tests/commands/install_uninstall_test.py --maxfail 1 --pdb -k install_pre_commit_and_run --color=no
============================= test session starts =============================
platform win32 -- Python 2.7.10, pytest-2.8.3, py-1.4.30, pluggy-0.3.1
rootdir: C:\Users\IEUser\Desktop\pre-commit, inifile:
collected 27 items

tests\commands\install_uninstall_test.py F
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> traceback >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

tempdir_factory = <tests.conftest.TmpdirFactory object at 0x0266A590>

    def test_install_pre_commit_and_run(tempdir_factory):
        path = make_consuming_repo(tempdir_factory, 'script_hooks_repo')
        with cwd(path):
            assert install(Runner(path)) == 0

            ret, output = _get_commit_output(tempdir_factory)
>           assert ret == 0
E           assert 1 == 0

tests\commands\install_uninstall_test.py:163: AssertionError
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> entering PDB >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> c:\users\ieuser\desktop\pre-commit\tests\commands\install_uninstall_test.py(163)test_install_pre_commit_and_run()
-> assert ret == 0
(Pdb) print(output)
[INFO] Initializing environment for c:\temp\pytest-of-IEUser\pytest-30\test_install_pre_commit_and_ru0\0.
An unexpected error has occurred: CalledProcessError: Command: ['git', 'clone', '--no-checkout', 'c:\\temp\\pytest-of-IEUser\\pytest-30\\test
_install_pre_commit_and_ru0\\0', 'c:\\temp\\pytest-of-IEUser\\pytest-30\\test_install_pre_commit_and_ru0\\2\\repoe4kase']
Return code: 128
Expected return code: 0
Output: (none)
Errors:
    fatal: working tree '.' already exists.


Check the log at ~/.pre-commit/pre-commit.log

(Pdb) c


!!!!!!!!!!!!!!!!!!! Interrupted: stopping after 1 failures !!!!!!!!!!!!!!!!!!!!
============ 26 tests deselected by '-kinstall_pre_commit_and_run' ============
=================== 1 failed, 26 deselected in 6.80 seconds ===================
(venv-pre_commit)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions