浏览代码

Fix incorrect gitstats version.

If the VERSION variable was not filled in, gitstats would run
'git rev-parse' on the repository being examined instead of the
gitstats repository.

Signed-off-by: Sven van Haastregt <svhaastr@liacs.nl>
Sven van Haastregt 13 年前
父节点
当前提交
8b475ea3e6
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3
    1
      gitstats

+ 3
- 1
gitstats 查看文件

@@ -92,7 +92,9 @@ VERSION = 0
92 92
 def getversion():
93 93
 	global VERSION
94 94
 	if VERSION == 0:
95
-		VERSION = getpipeoutput(["git rev-parse --short %s" % getcommitrange('HEAD')]).split('\n')[0]
95
+		gitstats_repo = os.path.dirname(os.path.abspath(__file__))
96
+		VERSION = getpipeoutput(["git --git-dir=%s/.git --work-tree=%s rev-parse --short %s" %
97
+			(gitstats_repo, gitstats_repo, getcommitrange('HEAD').split('\n')[0])])
96 98
 	return VERSION
97 99
 
98 100
 def getgitversion():