Skip to content
This repository was archived by the owner on Jul 24, 2022. It is now read-only.
This repository was archived by the owner on Jul 24, 2022. It is now read-only.

Command 'check --has-new-runs' crashes in a detached commit. #12

@atimin

Description

@atimin

Describe the bug
Command 'check' with flag '--has-new-runs' crashes if it is run in a detached commit

To Reproduce
Steps to reproduce the behavior:

  1. In the project directory run git checkout 0.3.0
  2. Run python -m nitpicker run --has-new-runs
  3. See error:
-----------------------------------
Check if all the last runs passed.
-----------------------------------
Plancommands.add has 0 failed and 0 skipped of 2 test cases
Plancommands.check has 0 failed and 0 skipped of 2 test cases
Plancommands.run has 0 failed and 0 skipped of 1 test cases
Totally your project has 0 failed and 0 skipped of 5 test cases
-----------------------------------
Check if current branch has new runs.
-----------------------------------
Traceback (most recent call last):
  File "/opt/python/3.3.6/lib/python3.3/runpy.py", line 160, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/opt/python/3.3.6/lib/python3.3/runpy.py", line 73, in _run_code
    exec(code, run_globals)
  File "./nitpicker/__main__.py", line 3, in <module>
    nitpicker.main()
  File "/home/travis/virtualenv/python3.3.6/lib/python3.3/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/travis/virtualenv/python3.3.6/lib/python3.3/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/travis/virtualenv/python3.3.6/lib/python3.3/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/travis/virtualenv/python3.3.6/lib/python3.3/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/travis/virtualenv/python3.3.6/lib/python3.3/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/travis/virtualenv/python3.3.6/lib/python3.3/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "./nitpicker/nitpicker.py", line 138, in check
    success &= handler.check_has_new_runs()
  File "./nitpicker/commands/check_command_handler.py", line 79, in check_has_new_runs
    diffs = list(self.__cvs_adapter.diff(self.__main_branch))
  File "./nitpicker/cvs/git_adapter.py", line 28, in diff
    branch = self.__repo.active_branch
  File "/home/travis/virtualenv/python3.3.6/lib/python3.3/site-packages/git/repo/base.py", line 696, in active_branch
    return self.head.reference
  File "/home/travis/virtualenv/python3.3.6/lib/python3.3/site-packages/git/refs/symbolic.py", line 275, in _get_reference
    raise TypeError("%s is a detached symbolic reference as it points to %r" % (self, sha))
TypeError: HEAD is a detached symbolic reference as it points to '670365d9258c7fd89e4ba43160d78c1a5f698f49'

Expected behavior
The program should not crash

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions