1{- git versions 2 - 3 - Copyright 2011, 2013 Joey Hess <id@joeyh.name> 4 - 5 - Licensed under the GNU AGPL version 3 or higher. 6 -} 7 8{-# OPTIONS_GHC -fno-warn-tabs #-} 9 10module Git.Version ( 11 installed, 12 older, 13 normalize, 14 GitVersion, 15) where 16 17import Utility.Process 18import Utility.DottedVersion 19 20type GitVersion = DottedVersion 21 22installed :: IO GitVersion 23installed = normalize . extract <$> readProcess "git" ["--version"] 24 where 25 extract s = case lines s of 26 [] -> "" 27 (l:_) -> unwords $ drop 2 $ words l 28 29older :: String -> IO Bool 30older n = do 31 v <- installed 32 return $ v < normalize n 33