frostming / legit

Git for Humans, Inspired by GitHub for Mac™.
https://frostming.github.io/legit
BSD 3-Clause "New" or "Revised" License
5.7k stars 218 forks source link

Updating to 1.0.0 causes TypeError to be raised #235

Closed nikoheikkila closed 6 years ago

nikoheikkila commented 6 years ago

Hi, found a bug in the latest release. Maybe someone could help me out with this?

Steps to reproduce

  1. Uninstall with pip uninstall legit
  2. Install with pip install legit
  3. Run legit --install and accept prompt
  4. Change directory to any Git repository and run legit

Actual behavior

Traceback (most recent call last):
  File "/usr/local/bin/legit", line 11, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1043, in invoke
    return Command.invoke(self, ctx)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/legit/cli.py", line 87, in cli
    ctx.obj = SCMRepo()
  File "/usr/local/lib/python3.6/site-packages/legit/scm.py", line 43, in __init__
    self.remote = self.get_remote()
  File "/usr/local/lib/python3.6/site-packages/legit/scm.py", line 256, in get_remote
    return self.remote(remote_name)
TypeError: 'NoneType' object is not callable

Expected behavior

No errors, command should print help text.

grahamu commented 6 years ago

@nikoheikkila Examining the code I see a circular reference on scm.py line 256, obviously not exercised by tests. Thanks for reporting this.

I've published a bug fix, v1.0.1 to PyPi. Please close this issue if this solves your problem, thanks!

nikoheikkila commented 6 years ago

@grahamu Seems to be working now. Thanks for the patch!

grahamu commented 6 years ago

@nikoheikkila you're welcome, thanks for your report!