diff options
Diffstat (limited to 'git_command.py')
-rw-r--r-- | git_command.py | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/git_command.py b/git_command.py index 89b681e1..354fc715 100644 --- a/git_command.py +++ b/git_command.py | |||
@@ -21,6 +21,7 @@ import tempfile | |||
21 | from signal import SIGTERM | 21 | from signal import SIGTERM |
22 | from error import GitError | 22 | from error import GitError |
23 | from trace import REPO_TRACE, IsTrace, Trace | 23 | from trace import REPO_TRACE, IsTrace, Trace |
24 | from wrapper import Wrapper | ||
24 | 25 | ||
25 | GIT = 'git' | 26 | GIT = 'git' |
26 | MIN_GIT_VERSION = (1, 5, 4) | 27 | MIN_GIT_VERSION = (1, 5, 4) |
@@ -84,19 +85,10 @@ class _GitCall(object): | |||
84 | 85 | ||
85 | def version_tuple(self): | 86 | def version_tuple(self): |
86 | global _git_version | 87 | global _git_version |
87 | |||
88 | if _git_version is None: | 88 | if _git_version is None: |
89 | ver_str = git.version().decode('utf-8') | 89 | ver_str = git.version().decode('utf-8') |
90 | if ver_str.startswith('git version '): | 90 | _git_version = Wrapper().ParseGitVersion(ver_str) |
91 | num_ver_str = ver_str[len('git version '):].strip().split('-')[0] | 91 | if _git_version is None: |
92 | to_tuple = [] | ||
93 | for num_str in num_ver_str.split('.')[:3]: | ||
94 | if num_str.isdigit(): | ||
95 | to_tuple.append(int(num_str)) | ||
96 | else: | ||
97 | to_tuple.append(0) | ||
98 | _git_version = tuple(to_tuple) | ||
99 | else: | ||
100 | print('fatal: "%s" unsupported' % ver_str, file=sys.stderr) | 92 | print('fatal: "%s" unsupported' % ver_str, file=sys.stderr) |
101 | sys.exit(1) | 93 | sys.exit(1) |
102 | return _git_version | 94 | return _git_version |