Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gl crashes if directory does not contain a repo with AttributeError: 'NoneType' object has no attribute 'decode' #179

Open
bK4gYuRo opened this issue Aug 7, 2018 · 3 comments

Comments

@bK4gYuRo
Copy link

bK4gYuRo commented Aug 7, 2018

If I run gl command in a directory which does not contain a git repository, it crashes:

ks-mbp:foo ks$ ls -la
total 0
drwxr-xr-x 2 ks staff 64 Aug 7 12:01 .
drwxr-xr-x 219 ks staff 7008 Aug 7 12:30 ..
ks-mbp:foo ks$ gl -h
Traceback (most recent call last):
File "/opt/local/bin/gl", line 11, in
load_entry_point('gitless==0.8.6', 'console_scripts', 'gl')()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/init.py", line 479, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/init.py", line 2703, in load_entry_point
return ep.load()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/init.py", line 2321, in load
return self.resolve()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/init.py", line 2327, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gitless/cli/gl.py", line 43, in
repo = core.Repository()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gitless/core.py", line 115, in init
self.git_repo = pygit2.Repository(path)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygit2/repository.py", line 1208, in init
path = path.decode('utf-8')
AttributeError: 'NoneType' object has no attribute 'decode'

I cannot even create a repository with "gl init" as it crashes with the same error.

@bK4gYuRo
Copy link
Author

bK4gYuRo commented Aug 7, 2018

Apparently this behavior was caused by recent upgrade of libgit2 and py27-pygit2 from 0.26.4_0 to 0.27.4. Rolling back to 0.26.4_0 restored normality. Is there any incompatibility between gitless and libgit2 0.27.4?

@spderosso
Copy link
Member

Thanks for looking into this. A breaking change was introduced in pygit 0.27 (changelog link) but PR #180 fixed it. If you are running Gitless 0.8.6 then you should use pygit 0.26, if are running from HEAD then both pygit 0.26 and pygit 0.27 should work.

@spderosso
Copy link
Member

The breaking change introduced in pygit2 0.27 is also causing it to crash on gl init. I will cut a new release with the fix soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants