-- 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
--   <a>https://www.stackage.org/package/githash</a>
@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, <tt>--version</tt> output, or diagnostic info for more
--   informative bug reports.
--   
--   <pre>
--   {-# LANGUAGE TemplateHaskell #-}
--   import GitHash
--   
--   panic :: String -&gt; 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!"
--   </pre>
--   
--   <pre>
--   % 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!
--   </pre>
--   
--   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 <tt>git describe --always</tt> for the most recent
--   commit.
giDescribe :: GitInfo -> String

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

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

-- | Get the <a>GitInfo</a> for the given root directory. Root directory
--   should be the directory containing the <tt>.git</tt> 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 <a>GitInfo</a> value at compile time for the given
--   directory. Compilation fails if no info is available.
tGitInfo :: FilePath -> SpliceQ GitInfo

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

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

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