git.iko.soy/typeable/gitrev
on master help sign in
Merge pull request #12 from vlopezj/untracked
a0cd8feAdam C. Foltzer
src/Development/GitRev.hs+10−1
@@ -32,7 +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 (gitHash, gitBranch, gitDirty, gitCommitCount, gitCommitDate) where
35+module Development.GitRev (gitHash, gitBranch, gitDirty, gitDirtyTracked, gitCommitCount, gitCommitDate) where
36
36
37import Control.Exception
37import Control.Exception
38import Control.Monad
38import Control.Monad
@@ -136,6 +136,15 @@ gitDirty = do
136 "" -> conE falseName
136 "" -> conE falseName
137 _ -> conE trueName
137 _ -> conE trueName
138
138
139+-- | Return @True@ if there are non-commited changes to tracked files
140+-- present in the repository
141+gitDirtyTracked :: ExpQ
142+gitDirtyTracked = do
143+ output <- runGit ["status", "--porcelain","--untracked-files=no"] "" IdxUsed
144+ case output of
145+ "" -> conE falseName
146+ _ -> conE trueName
147+
139-- | Return the number of commits in the current head
148-- | Return the number of commits in the current head
140gitCommitCount :: ExpQ
149gitCommitCount :: ExpQ
141gitCommitCount =
150gitCommitCount =