2013-08-02 22:31:01 +00:00
|
|
|
{- git versions
|
2011-12-22 18:59:25 +00:00
|
|
|
-
|
2013-08-02 22:31:01 +00:00
|
|
|
- Copyright 2011, 2013 Joey Hess <joey@kitenet.net>
|
2011-12-22 18:59:25 +00:00
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
2014-12-16 18:04:40 +00:00
|
|
|
module Git.Version (
|
|
|
|
installed,
|
|
|
|
normalize,
|
|
|
|
GitVersion,
|
|
|
|
) where
|
2011-12-22 18:59:25 +00:00
|
|
|
|
|
|
|
import Common
|
2014-12-16 18:04:40 +00:00
|
|
|
import Utility.DottedVersion
|
2011-12-22 18:59:25 +00:00
|
|
|
|
2014-12-16 18:04:40 +00:00
|
|
|
type GitVersion = DottedVersion
|
2013-08-02 22:31:01 +00:00
|
|
|
|
|
|
|
installed :: IO GitVersion
|
|
|
|
installed = normalize . extract <$> readProcess "git" ["--version"]
|
|
|
|
where
|
2014-10-09 18:53:13 +00:00
|
|
|
extract s = case lines s of
|
2013-08-02 22:31:01 +00:00
|
|
|
[] -> ""
|
|
|
|
(l:_) -> unwords $ drop 2 $ words l
|