githash 0.1.3.0 → 0.1.3.1
raw patch · 3 files changed
+13/−10 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- githash.cabal +3/−3
- src/GitHash.hs +6/−7
ChangeLog.md view
@@ -1,5 +1,9 @@ # ChangeLog for githash +## 0.1.3.1++* Clean up some warnings (addresses [fpco/optparse-simple#11](https://github.com/fpco/optparse-simple/issues/11))+ ## 0.1.3.0 * Catch exceptions thrown by `readCreateProcessWithExitCode` to deal
githash.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.30.0.+-- This file has been generated from package.yaml by hpack version 0.31.1. -- -- see: https://github.com/sol/hpack ----- hash: 2d1ac1215ae90e4ef0ec7e8b32fb6fae19439ce136c6f063598c703167993f92+-- hash: e259226f20bb47090315089e5ac66234ed83b30d011b5f6dc29b4f74f8134b58 name: githash-version: 0.1.3.0+version: 0.1.3.1 synopsis: Compile git revision info into Haskell projects description: Please see the README and documentation at <https://www.stackage.org/package/githash> category: Development
src/GitHash.hs view
@@ -20,12 +20,13 @@ -- > panic :: String -> a -- > panic msg = error panicMsg -- > where panicMsg =--- > concat [ "[panic ", $(gitBranch), "@", $(gitHash)--- > , " (", $(gitCommitDate), ")"--- > , " (", $(gitCommitCount), " commits in HEAD)"+-- > concat [ "[panic ", giBranch gi, "@", giHash gi+-- > , " (", giCommitDate gi, ")"+-- > , " (", show (giCommitCount gi), " commits in HEAD)" -- > , dirty, "] ", msg ]--- > dirty | $(gitDirty) = " (uncommitted files present)"+-- > dirty | giDirty gi = " (uncommitted files present)" -- > | otherwise = ""+-- > gi = $$tGitInfoCwd -- > -- > main = panic "oh no!" --@@ -56,12 +57,9 @@ , tGitInfoCwdTry ) where -import Control.Applicative import Control.Exception-import Control.Monad import qualified Data.ByteString as B import qualified Data.ByteString.Char8 as B8-import Data.Maybe import Data.Typeable (Typeable) import Language.Haskell.TH import Language.Haskell.TH.Syntax@@ -181,6 +179,7 @@ getGitRoot :: FilePath -> IO (Either GitHashException FilePath) getGitRoot dir = fmap (normalise . takeWhile (/= '\n')) `fmap` (runGit dir ["rev-parse", "--show-toplevel"]) +runGit :: FilePath -> [String] -> IO (Either GitHashException String) runGit root args = do let cp = (proc "git" args) { cwd = Just root } eres <- try $ readCreateProcessWithExitCode cp ""