commit 520722b8e3a7bb72bf9b5063f3c1649b53110225 Author: aagbsn aagbsn@extc.org Date: Wed Sep 14 16:56:16 2011 -0700
4024 - get_git_version does not work for submodule
Added support for detached heads --- TorUtil.py | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/TorUtil.py b/TorUtil.py index 73ea2a8..fee4407 100644 --- a/TorUtil.py +++ b/TorUtil.py @@ -429,9 +429,13 @@ def get_git_version(path_to_repo): plog('NOTICE', 'Git Repo at %s Not Found' % path_to_repo) return ('unknown','unknown') try: - f = open(path_to_repo+ref[1]) - branch = ref[1].strip().split('/')[-1] - head = f.readline().strip() + if len(ref) > 1: + f = open(path_to_repo+ref[1]) + branch = ref[1].strip().split('/')[-1] + head = f.readline().strip() + else: + branch = 'detached' + head = ref[0] f.close() return (branch, head) except IOError, e: