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


-- | Simple Git Wrapper
--   
--   Simple git wrapper to access common git functions in a simple haskell
--   way.
@package libgit
@version 0.3.1

module Lib.Git.Type

-- | Run a git context from a config and returns the result
runGit :: Config -> GitCtx t -> IO t
type GitFailure = (Int, String, String, String, [String])

-- | internal function to execute a git command
gitExec :: String -> [String] -> [(String, String)] -> GitCtx (Either GitFailure String)

-- | internal function to call on failure to make a friendly error message
gitError :: GitFailure -> String -> b
data GitCtx a
makeConfig :: FilePath -> Maybe FilePath -> Config

-- | Tagged ID of all possible types
data Object
Commit :: CommitID -> Object
Blob :: BlobID -> Object
Tree :: TreeID -> Object
Tag :: TagID -> Object

-- | Represent a repository
data Config
Config :: FilePath -> Maybe FilePath -> Config

-- | Path to the repository .git
[configCwd] :: Config -> FilePath

-- | Optional path to the git executable (otherwise resolved from $PATH)
[configGitPath] :: Config -> Maybe FilePath

-- | Commit entity representation
data Commitent
Commitent :: [CommitID] -> TreeID -> Person -> String -> Person -> String -> String -> Commitent
[ceParents] :: Commitent -> [CommitID]
[ceTree] :: Commitent -> TreeID
[ceAuthor] :: Commitent -> Person
[ceAuthorTime] :: Commitent -> String
[ceCommitter] :: Commitent -> Person
[ceCommitterTime] :: Commitent -> String
[ceCommitMsg] :: Commitent -> String

-- | Commit object author/commiter representation
data Person
Person :: String -> String -> Person
[personName] :: Person -> String
[personEmail] :: Person -> String

-- | any ID (git SHA1 string)
type ID = String

-- | a commit ID
type CommitID = ID

-- | a blob ID
type BlobID = ID

-- | a tree ID
type TreeID = ID

-- | a tag ID
type TagID = ID
toID :: String -> ID
objToID :: Object -> ID
objOfString :: String -> ID -> Maybe Object
instance GHC.Show.Show Lib.Git.Type.Commitent
instance GHC.Show.Show Lib.Git.Type.Person
instance Control.Monad.Reader.Class.MonadReader Lib.Git.Type.Config Lib.Git.Type.GitCtx
instance Control.Monad.IO.Class.MonadIO Lib.Git.Type.GitCtx
instance GHC.Base.Monad Lib.Git.Type.GitCtx
instance GHC.Base.Applicative Lib.Git.Type.GitCtx
instance GHC.Base.Functor Lib.Git.Type.GitCtx
instance GHC.Show.Show Lib.Git.Type.Config
instance GHC.Show.Show Lib.Git.Type.Object

module Lib.Git.Tree

-- | return a tree entity from a commitid if commitid is ommitted, it uses
--   HEAD.
treeList :: Maybe CommitID -> GitCtx Treeent
type Perms = (Int, Int, Int, Int, Int, Int)
permsOfString :: String -> Perms
type Treeent = [(Perms, Object, FilePath)]

module Lib.Git.Lowlevel

-- | return a commit list in reverse chronological order l
revlist :: Maybe Int -> Maybe CommitID -> [FilePath] -> GitCtx [CommitID]

-- | parse a tag<i>branch-name</i>commit into a commit if it exists
revparse :: String -> GitCtx (Maybe CommitID)

-- | cat a blob objects
catBlob :: BlobID -> GitCtx String

-- | cat a tag objects
catTag :: TagID -> GitCtx String
catTree :: TreeID -> GitCtx Treeent
catCommit :: CommitID -> GitCtx Commitent

module Lib.Git.Index

-- | update index with the list of file
indexUpdate :: [FilePath] -> GitCtx ()
indexCheckoutAll :: Bool -> GitCtx ()
indexCheckout :: [FilePath] -> Bool -> GitCtx ()
indexList :: GitCtx (FilePath)


-- | Portabily : haven't tested
--   
--   This module provide Git functionality exec'ing the git binary.
--   
--   give simple access to commit, tree, tag, blob objects.
module Lib.Git
taglist :: GitCtx [TagID]
initDB :: Bool -> GitCtx ()
add :: [FilePath] -> GitCtx ()
rm :: [FilePath] -> GitCtx ()
commit :: [FilePath] -> String -> String -> String -> [String] -> GitCtx ()
checkout :: Maybe CommitID -> Maybe String -> GitCtx ()
hasDiff :: GitCtx Bool
resolveFilePath :: Commitent -> FilePath -> GitCtx [(FilePath, Object)]
