Skip to content

Commit

Permalink
Fixed version checking for 'git' on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulmutt committed Oct 25, 2016
1 parent e60d1da commit 503f45f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Cabal/Distribution/Simple/Program/Builtin.hs
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,13 @@ gitProgram = (simpleProgram "git") {
programFindVersion = findProgramVersion "--version" $ \str ->
-- Invoking "git --version" gives a string like
--- "git version 2.7.4 (Apple Git-66)"
case words str of
(_:_:version:_) -> version
let split cs = case break (=='.') cs of
(chunk,[]) -> chunk : []
(chunk,_:rest) -> chunk : split rest
join [s] = s
join (s:ss) = s ++ ('.' : join ss)
in case words str of
(_:_:version:_) -> join . take 3 $ split version
_ -> ""
}

Expand Down

0 comments on commit 503f45f

Please sign in to comment.