Commit 02510ec2 by Anastasis Andronidis

--version is now taking the correct head

parent f41d3b9b
...@@ -328,10 +328,12 @@ def _gitinfo(): ...@@ -328,10 +328,12 @@ def _gitinfo():
# Check if the .git is a file. If it is a file, it means that we are in a submodule structure. # Check if the .git is a file. If it is a file, it means that we are in a submodule structure.
if os.path.isfile(repo_path): if os.path.isfile(repo_path):
try: try:
central_gitdir = yaml.load(open(repo_path)).get('gitdir').split('.git')[0] gitdir = yaml.load(open(repo_path)).get('gitdir')
repo_path = repo_path.split('.git')[0]
# There is a posibility the .git file to have an absolute path. # There is a posibility the .git file to have an absolute path.
repo_path = os.path.join(repo_path, os.path.relpath(central_gitdir), '.git') if os.path.isabs(gitdir):
repo_path = gitdir
else:
repo_path = os.path.join(repo_path.split('.git')[0], gitdir)
except (IOError, AttributeError): except (IOError, AttributeError):
return '' return ''
f = open(os.path.join(repo_path, "HEAD")) f = open(os.path.join(repo_path, "HEAD"))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment