xref: /JGit/tools/git.defs (revision 776c3003aa0f6d66f222c2d74d86a59cf9f8fe98)
1def git_version():
2  import subprocess
3  cmd = ['git', 'describe', '--always', '--match', 'v[0-9].*', '--dirty']
4  p = subprocess.Popen(cmd, stdout = subprocess.PIPE)
5  v = p.communicate()[0].strip()
6  r = p.returncode
7  if r != 0:
8    raise subprocess.CalledProcessError(r, ' '.join(cmd))
9  return v
10