git_version: cache the Git version

(to avoid repeated invocations of `git version`)
This commit is contained in:
Andrew Ayer
2015-05-24 18:58:13 -07:00
parent 1988ee3819
commit 4acb4205eb

View File

@@ -89,9 +89,10 @@ static std::vector<int> parse_version (const std::string& str)
return version;
}
static std::vector<int> git_version ()
static const std::vector<int>& git_version ()
{
return parse_version(git_version_string());
static const std::vector<int> version(parse_version(git_version_string()));
return version;
}
static std::vector<int> make_version (int a, int b, int c)