git.iko.soy/typeable/gitrev
on e1f2867 help sign in
gitrev.cabal+1−1
since splitsnapshots
unifiedsplit
@@ -1,5 +1,5 @@
1name: gitrev
1name: gitrev
2−version: 1.3.1
2+version: 1.3.0
3synopsis: Compile git revision info into Haskell projects
3synopsis: Compile git revision info into Haskell projects
4homepage: https://github.com/acfoltzer/gitrev
4homepage: https://github.com/acfoltzer/gitrev
5license: BSD3
5license: BSD3
src/Development/GitRev.hs+3−17
@@ -32,15 +32,7 @@
32-- > % cabal exec runhaskell Example.hs
32-- > % cabal exec runhaskell Example.hs
33-- > Example.hs: [panic master@2ae047ba5e4a6f0f3e705a43615363ac006099c1 (Mon Jan 11 11:50:59 2016 -0800) (14 commits in HEAD) (uncommitted files present)] oh no!
33-- > Example.hs: [panic master@2ae047ba5e4a6f0f3e705a43615363ac006099c1 (Mon Jan 11 11:50:59 2016 -0800) (14 commits in HEAD) (uncommitted files present)] oh no!
34
34
35−module Development.GitRev
35+module Development.GitRev (gitHash, gitBranch, gitDirty, gitDirtyTracked, gitCommitCount, gitCommitDate) where
36− ( gitBranch
37− , gitCommitCount
38− , gitCommitDate
39− , gitDescribe
40− , gitDirty
41− , gitDirtyTracked
42− , gitHash
43− ) where
44
36
45import Control.Exception
37import Control.Exception
46import Control.Monad
38import Control.Monad
@@ -66,7 +58,7 @@ runGit args def useIdx = do
66 if gitFound
58 if gitFound
67 then do
59 then do
68 -- a lot of bookkeeping to record the right dependencies
60 -- a lot of bookkeeping to record the right dependencies
69− pwd <- runIO getDotGit
61+ pwd <- runIO getGitDirectory
70 let hd = pwd </> ".git" </> "HEAD"
62 let hd = pwd </> ".git" </> "HEAD"
71 index = pwd </> ".git" </> "index"
63 index = pwd </> ".git" </> "index"
72 packedRefs = pwd </> ".git" </> "packed-refs"
64 packedRefs = pwd </> ".git" </> "packed-refs"
@@ -121,7 +113,7 @@ getDotGit = do
121getGitRoot :: IO FilePath
113getGitRoot :: IO FilePath
122getGitRoot = do
114getGitRoot = do
123 pwd <- getCurrentDirectory
115 pwd <- getCurrentDirectory
124− (code, out, _) <-
116+ (code, out, err) <-
125 readProcessWithExitCode "git" ["rev-parse", "--show-toplevel"] ""
117 readProcessWithExitCode "git" ["rev-parse", "--show-toplevel"] ""
126 case code of
118 case code of
127 ExitSuccess -> return $ takeWhile (/= '\n') out
119 ExitSuccess -> return $ takeWhile (/= '\n') out
@@ -145,12 +137,6 @@ gitBranch :: ExpQ
145gitBranch =
137gitBranch =
146 stringE =<< runGit ["rev-parse", "--abbrev-ref", "HEAD"] "UNKNOWN" IdxNotUsed
138 stringE =<< runGit ["rev-parse", "--abbrev-ref", "HEAD"] "UNKNOWN" IdxNotUsed
147
139
148−-- | Return the long git description for the current git commit, or
149−-- @UNKNOWN@ if not in a git repository.
150−gitDescribe :: ExpQ
151−gitDescribe =
152− stringE =<< runGit ["describe", "--long", "--always"] "UNKNOWN" IdxNotUsed
153−
154-- | Return @True@ if there are non-committed files present in the
140-- | Return @True@ if there are non-committed files present in the
155-- repository
141-- repository
156gitDirty :: ExpQ
142gitDirty :: ExpQ