From 24bc8414a8d3fc74dc643581a60c663718c1deee Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Tue, 7 Jun 2011 23:39:53 +0200 Subject: git.version_info now returns exactly 4 numbers --- git/cmd.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'git/cmd.py') diff --git a/git/cmd.py b/git/cmd.py index 29d942ae..22a8924b 100644 --- a/git/cmd.py +++ b/git/cmd.py @@ -223,8 +223,9 @@ class Git(LazyMixin): def _set_cache_(self, attr): if attr == '_version_info': + # We only use the first 4 numbers, as everthing else could be strings in fact (on windows) version_numbers = self._call_process('version').rpartition(' ')[2] - self._version_info = tuple(int(n) for n in version_numbers.split('.')) + self._version_info = tuple(int(n) for n in version_numbers.split('.')[:4]) else: super(Git, self)._set_cache_(attr) #END handle version info @@ -237,7 +238,8 @@ class Git(LazyMixin): @property def version_info(self): - """:return: tuple(int, ...) tuple with integers representing the major, minor + """ + :return: tuple(int, int, int, int) tuple with integers representing the major, minor and additional version numbers as parsed from git version. This value is generated on demand and is cached""" return self._version_info -- cgit v1.2.3