Skip to content

version_info dies with git RC version #123

Closed

Description

@sugi

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'

Activity

  1. jschlather commented on Oct 7, 2013

    @jschlather

    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.

  2. sugi commented on Oct 7, 2013

    @sugi
    ContributorAuthor

    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.

  3. Byron commented on Nov 19, 2014

    @Byron
    Member

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

  4. added this to the v0.3.2 milestone on Nov 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions