Skip to content

tach test assumes the main branch is called main #888

@DetachHead

Description

@DetachHead
$ tach test
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/me/pytest-robotframework/.venv/lib/python3.13/site-packages/tach/filesystem/git_ops.py", line 163, in get_changed_files
INTERNALERROR>     diff: str = repo.git.diff("--name-status", base)
INTERNALERROR>                 ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/me/pytest-robotframework/.venv/lib/python3.13/site-packages/git/cmd.py", line 1003, in <lambda>
INTERNALERROR>     return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
INTERNALERROR>                                    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/me/pytest-robotframework/.venv/lib/python3.13/site-packages/git/cmd.py", line 1616, in _call_process
INTERNALERROR>     return self.execute(call, **exec_kwargs)
INTERNALERROR>            ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/me/pytest-robotframework/.venv/lib/python3.13/site-packages/git/cmd.py", line 1406, in execute
INTERNALERROR>     raise GitCommandError(redacted_command, status, stderr_value, stdout_value)
INTERNALERROR> git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
INTERNALERROR>   cmdline: git diff --name-status main
INTERNALERROR>   stderr: 'fatal: ambiguous argument 'main': unknown revision or path not in the working tree.
INTERNALERROR> Use '--' to separate paths from revisions, like this:
INTERNALERROR> 'git <command> [<revision>...] -- [<file>...]''
INTERNALERROR> 
INTERNALERROR> During handling of the above exception, another exception occurred:
INTERNALERROR> 
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/me/pytest-robotframework/.venv/lib/python3.13/site-packages/_pytest/main.py", line 314, in wrap_session
INTERNALERROR>     config._do_configure()
INTERNALERROR>     ~~~~~~~~~~~~~~~~~~~~^^
INTERNALERROR>   File "/home/me/pytest-robotframework/.venv/lib/python3.13/site-packages/_pytest/config/__init__.py", line 1159, in _do_configure
INTERNALERROR>     self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR>     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/me/pytest-robotframework/.venv/lib/python3.13/site-packages/pluggy/_hooks.py", line 534, in call_historic
INTERNALERROR>     res = self._hookexec(self.name, self._hookimpls.copy(), kwargs, False)
INTERNALERROR>   File "/home/me/pytest-robotframework/.venv/lib/python3.13/site-packages/pluggy/_manager.py", line 120, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>            ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/me/pytest-robotframework/.venv/lib/python3.13/site-packages/pluggy/_callers.py", line 167, in _multicall
INTERNALERROR>     raise exception
INTERNALERROR>   File "/home/me/pytest-robotframework/.venv/lib/python3.13/site-packages/pluggy/_callers.py", line 121, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/me/pytest-robotframework/.venv/lib/python3.13/site-packages/tach/pytest_plugin.py", line 51, in pytest_configure
INTERNALERROR>     changed_files = get_changed_files(**kwargs)
INTERNALERROR>   File "/home/me/pytest-robotframework/.venv/lib/python3.13/site-packages/tach/filesystem/git_ops.py", line 166, in get_changed_files
INTERNALERROR>     raise TachError(f"Failed to check diff between '{base}' and {head_display}!")
INTERNALERROR> tach.errors.TachError: Failed to check diff between 'main' and current filesystem!

it could be called master or something else. pretty sure there's a way to reliably determine the default branch name, so we should do that instead of making this assumption

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions