From 4acb4205ebbf64b6f2faf198a71a6134b3be7416 Mon Sep 17 00:00:00 2001 From: Andrew Ayer Date: Sun, 24 May 2015 18:58:13 -0700 Subject: [PATCH] git_version: cache the Git version (to avoid repeated invocations of `git version`) --- commands.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/commands.cpp b/commands.cpp index 19111e3..2b86930 100644 --- a/commands.cpp +++ b/commands.cpp @@ -89,9 +89,10 @@ static std::vector parse_version (const std::string& str) return version; } -static std::vector git_version () +static const std::vector& git_version () { - return parse_version(git_version_string()); + static const std::vector version(parse_version(git_version_string())); + return version; } static std::vector make_version (int a, int b, int c)