gitrev 1.0.0 → 1.1.0
raw patch · 2 files changed
+11/−4 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Development.GitRev: gitCommitCount :: ExpQ
Files
- gitrev.cabal +1/−1
- src/Development/GitRev.hs +10/−3
gitrev.cabal view
@@ -1,5 +1,5 @@ name: gitrev-version: 1.0.0+version: 1.1.0 synopsis: Compile git revision info into Haskell projects homepage: https://github.com/acfoltzer/gitrev license: BSD3
src/Development/GitRev.hs view
@@ -17,16 +17,18 @@ -- > panic :: String -> a -- > panic msg = error panicMsg -- > where panicMsg =--- > concat [ "[panic ", $(gitBranch), "@", $(gitHash), dirty, "] ", msg ]+-- > concat [ "[panic ", $(gitBranch), "@", $(gitHash)+-- > , " (", $(gitCommitCount), " commits in HEAD)"+-- > , dirty, "] ", msg ] -- > dirty | $(gitDirty) = " (uncommitted files present)" -- > | otherwise = "" -- > -- > main = panic "oh no!" -- -- > % cabal exec runhaskell Example.hs--- > Example.hs: [panic master@4a0a592c37ad908889bd2a7a411923a903ed05a3 (uncommitted files present)] oh no!+-- > Example.hs: [panic master@2702e69355c978805064543489c351b61ac6760b (6 commits in HEAD) (uncommitted files present)] oh no! -module Development.GitRev (gitHash, gitBranch, gitDirty) where+module Development.GitRev (gitHash, gitBranch, gitDirty, gitCommitCount) where import Control.Applicative import Control.Exception@@ -103,3 +105,8 @@ case output of "" -> conE $ mkName "Prelude.False" _ -> conE $ mkName "Prelude.True"++-- | Return the number of commits in the current head+gitCommitCount :: ExpQ+gitCommitCount =+ stringE =<< runGit ["rev-list", "HEAD", "--count"] "UNKNOWN"