Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix weird apple git version #1006

Merged
merged 1 commit into from
Nov 17, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/app/FakeLib/Git/Information.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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

Expand Down