-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Compile git revision info into Haskell projects
--   
--   Please see the README and documentation at
--   https://www.stackage.org/package/githash
@package githash
@version 0.1.7.0

-- | Some handy Template Haskell splices for including the current git hash
--   and branch in the code of your project. Useful for including in panic
--   messages, --version output, or diagnostic info for more
--   informative bug reports.
--   
--   
--   {-# LANGUAGE TemplateHaskell #-}
--   import GitHash
--   
--   panic :: String -> a
--   panic msg = error panicMsg
--     where panicMsg =
--             concat [ "[panic ", giBranch gi, "@", giHash gi
--                    , " (", giCommitDate gi, ")"
--                    , " (", show (giCommitCount gi), " commits in HEAD)"
--                    , dirty, "] ", msg ]
--           dirty | giDirty gi = " (uncommitted files present)"
--                 | otherwise   = ""
--           gi = $$tGitInfoCwd
--   
--   main = panic "oh no!"
--   
--   
--   
--   % stack runghc Example.hs
--   Example.hs: [panic master@2ae047ba5e4a6f0f3e705a43615363ac006099c1 (Mon Jan 11 11:50:59 2016 -0800) (14 commits in HEAD) (uncommitted files present)] oh no!
--   
--   
--   WARNING: None of this will work in a git repository without any
--   commits.
module GitHash

-- | Various pieces of information about a Git repository.
data GitInfo

-- | Exceptions which can occur when using this library's functions.
data GitHashException
GHECouldn'tReadFile :: !FilePath -> !IOException -> GitHashException
GHEInvalidCommitCount :: !FilePath -> !String -> GitHashException
GHEInvalidGitFile :: !String -> GitHashException
GHEGitRunFailed :: !FilePath -> ![String] -> !ExitCode -> !String -> !String -> GitHashException
GHEGitRunException :: !FilePath -> ![String] -> !IOException -> GitHashException

-- | The hash of the most recent commit.
giHash :: GitInfo -> String

-- | The hash of the most recent commit.
giBranch :: GitInfo -> String
giDirty :: GitInfo -> Bool
giCommitDate :: GitInfo -> String
giCommitCount :: GitInfo -> Int

-- | The message of the most recent commit.
giCommitMessage :: GitInfo -> String

-- | The output of git describe --always for the most recent
--   commit.
giDescribe :: GitInfo -> String

-- | The output of git describe --always --tags for the most
--   recent commit.
giTag :: GitInfo -> String

-- | The files used to determine whether recompilation is necessary in
--   splices.
giFiles :: GitInfo -> [FilePath]

-- | Get the GitInfo for the given root directory. Root directory
--   should be the directory containing the .git directory.
getGitInfo :: FilePath -> IO (Either GitHashException GitInfo)

-- | Get the root directory of the Git repo containing the given file path.
getGitRoot :: FilePath -> IO (Either GitHashException FilePath)

-- | Load up the GitInfo value at compile time for the given
--   directory. Compilation fails if no info is available.
tGitInfo :: FilePath -> SpliceQ GitInfo

-- | Load up the GitInfo value at compile time for the current
--   working directory.
tGitInfoCwd :: SpliceQ GitInfo

-- | Try to load up the GitInfo value at compile time for the given
--   directory.
tGitInfoTry :: FilePath -> SpliceQ (Either String GitInfo)

-- | Try to load up the GitInfo value at compile time for the
--   current working directory.
tGitInfoCwdTry :: SpliceQ (Either String GitInfo)
instance GHC.Classes.Eq GitHash.GitHashException
instance GHC.Internal.Exception.Type.Exception GitHash.GitHashException
instance Language.Haskell.TH.Syntax.Lift GitHash.GitInfo
instance GHC.Internal.Show.Show GitHash.GitHashException
instance GHC.Internal.Show.Show GitHash.GitInfo
