From c0486f970a99a3666cb71736407f2e59a11d4227 Mon Sep 17 00:00:00 2001 From: Albert-Jan Nijburg Date: Tue, 17 Nov 2015 10:28:49 +0000 Subject: [PATCH] fix weird apple git version --- src/app/FakeLib/Git/Information.fs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/app/FakeLib/Git/Information.fs b/src/app/FakeLib/Git/Information.fs index 9bc88e2bf6a..719c7779591 100644 --- a/src/app/FakeLib/Git/Information.fs +++ b/src/app/FakeLib/Git/Information.fs @@ -4,8 +4,11 @@ module Fake.Git.Information open Fake open System +open System.Text.RegularExpressions open System.IO +let versionRegex = Regex("^git version ([\d.]{5}).*$", RegexOptions.Compiled) + /// Gets the git version let getVersion repositoryDir = let ok,msg,errors = runGitCommand repositoryDir "--version" @@ -18,7 +21,12 @@ let isVersionHigherOrEqual currentVersion referenceVersion = let isGitVersionHigherOrEqual referenceVersion = let currentVersion = getVersion "." - let versionParts = currentVersion.Replace("git version ","") + let regexRes = versionRegex.Match currentVersion + let versionParts = + if regexRes.Success then + regexRes.Groups.[1].Value + else + failwith "unable to find git version" isVersionHigherOrEqual versionParts referenceVersion