Skip to content

version_info dies with git RC version #123

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

Closed
sugi opened this issue Oct 7, 2013 · 3 comments
Closed

version_info dies with git RC version #123

sugi opened this issue Oct 7, 2013 · 3 comments
Milestone

Comments

@sugi
Copy link
Contributor

sugi commented Oct 7, 2013

git.cmd.Git.version_info gets ValueError when it's running with git RC release.

I think it may be OK to just skip non-integer values of version.

sugi@tempest:~% git --version
git version 1.8.4.rc3
sugi@tempest:~% python                                                        
Python 2.7.3 (default, Jan  2 2013, 13:56:14) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import git
>>> g = git.Git()
>>> g.version()
'git version 1.8.4.rc3'
>>> g.version_info
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "git/cmd.py", line 261, in version_info
    return self._version_info
  File "git/cmd.py", line 237, in __getattr__
    return LazyMixin.__getattr__(self, name)
  File "git/util.py", line 357, in __getattr__
    self._set_cache_(attr)
  File "git/cmd.py", line 244, in _set_cache_
    self._version_info = tuple(int(n) for n in version_numbers.split('.')[:4])
  File "git/cmd.py", line 244, in <genexpr>
    self._version_info = tuple(int(n) for n in version_numbers.split('.')[:4])
ValueError: invalid literal for int() with base 10: 'rc3'
@jschlather
Copy link

It looks like cmd.py expects a 4-tuple of integers. I also believe that git version 1.8.4 has been released, so upgrading git would also solve this issue. Other than that it looks like some sort of logic for dealing with release candidates would have to be added.

@sugi
Copy link
Contributor Author

sugi commented Oct 7, 2013

Yeah, I almost agree with you...
On the other hand, I wish that a library for git works without exception even if git RC release.

Anyway, I opened this issue to just report/notice. Please close this freely.

@Byron
Copy link
Member

Byron commented Nov 19, 2014

The fix was merged and made available in v0.3.2 on pypi.

@Byron Byron closed this as completed Nov 19, 2014
@Byron Byron added this to the v0.3.2 milestone Nov 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants