def git_version(git_path=_DEFAULT_GIT):
 try:
  output = run_git_or_fail(['--version'], git_path=git_path)
 except OSError:
  return None
 version_prefix = 'git version '
 if (not output.startswith(version_prefix)):
  return None
 parts = output[len(version_prefix):].split('.')
 nums = []
 for part in parts:
  try:
   nums.append(int(part))
  except ValueError:
   break
 while (len(nums) < _VERSION_LEN):
  nums.append(0)
 return tuple(nums[:_VERSION_LEN])

def git_version ( git_path = _DEFAULT_GIT ) : try : output = run_git_or_fail ( [ '--version' ] , git_path = git_path ) except OSError : return None version_prefix = 'git version ' if ( not output . startswith ( version_prefix ) ) : return None parts = output [ len ( version_prefix ) : ] . split ( '.' ) nums = [ ] for part in parts : try : nums . append ( int ( part ) ) except ValueError : break while ( len ( nums ) < _VERSION_LEN ) : nums . append ( 0 ) return tuple ( nums [ : _VERSION_LEN ] )
attempt to determine the version of git currently installed .