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


-- | Git operations in haskell
--   
--   A Haskell implementation of git storage operations, allowing users to
--   manipulate git repositories (read and write).
--   
--   This implementation is fully interoperable with the main C
--   implementation.
--   
--   This is strictly only manipulating the git store (what's inside the
--   .git directory), and doesn't do anything with the index or your
--   working directory files.
@package git
@version 0.2.1


module Data.Git.Ref

-- | represent a git reference (SHA1)
data Ref hash

-- | SHA1 cryptographic hash algorithm
data SHA1 :: *

-- | Class representing hashing algorithms.
--   
--   The interface presented here is update in place and lowlevel. the Hash
--   module takes care of hidding the mutable interface properly.
class HashAlgorithm a

-- | Get the digest size of a hash algorithm
hashDigestSize :: HashAlgorithm a => a -> Int

-- | Get the digest size of a hash algorithm
hashDigestSize :: HashAlgorithm a => a -> Int

-- | Invalid Reference exception raised when using something that is not a
--   ref as a ref.
data RefInvalid
RefInvalid :: ByteString -> RefInvalid

-- | Reference wasn't found
data RefNotFound hash
RefNotFound :: (Ref hash) -> RefNotFound hash
isHex :: ByteString -> Bool
isHexString :: String -> Bool

-- | take a hexadecimal bytestring that represent a reference and turn into
--   a ref
fromHex :: HashAlgorithm hash => ByteString -> Ref hash

-- | take a hexadecimal string that represent a reference and turn into a
--   ref
fromHexString :: HashAlgorithm hash => String -> Ref hash

-- | transform a bytestring that represent a binary bytestring and returns
--   a ref.
fromBinary :: HashAlgorithm hash => ByteString -> Ref hash

-- | transform a bytestring that represent a binary bytestring and returns
--   a ref.
fromDigest :: HashAlgorithm hash => Digest hash -> Ref hash

-- | turn a reference into a binary bytestring
toBinary :: Ref hash -> ByteString

-- | transform a ref into an hexadecimal bytestring
toHex :: Ref hash -> ByteString

-- | transform a ref into an hexadecimal string
toHexString :: Ref hash -> String

-- | returns the prefix (leading byte) of this reference
refPrefix :: Ref hash -> Int

-- | compare prefix
cmpPrefix :: String -> Ref hash -> Ordering

-- | returns the splitted format "prefix/suffix" for addressing the loose
--   object database
toFilePathParts :: Ref hash -> (String, String)

-- | hash a bytestring into a reference
hash :: HashAlgorithm hash => ByteString -> Ref hash

-- | hash a lazy bytestring into a reference
hashLBS :: HashAlgorithm hash => ByteString -> Ref hash

-- | Any hash algorithm
hashAlg :: HashAlgorithm hash => hash
hashAlgFromRef :: HashAlgorithm hash => Ref hash -> hash
instance GHC.Classes.Eq (Data.Git.Ref.RefNotFound hash)
instance GHC.Show.Show (Data.Git.Ref.RefNotFound hash)
instance Data.Data.Data Data.Git.Ref.RefInvalid
instance GHC.Classes.Eq Data.Git.Ref.RefInvalid
instance GHC.Show.Show Data.Git.Ref.RefInvalid
instance GHC.Classes.Ord (Data.Git.Ref.Ref hash)
instance GHC.Classes.Eq (Data.Git.Ref.Ref hash)
instance Data.Typeable.Internal.Typeable hash => GHC.Exception.Exception (Data.Git.Ref.RefNotFound hash)
instance GHC.Exception.Exception Data.Git.Ref.RefInvalid
instance GHC.Show.Show (Data.Git.Ref.Ref hash)


module Data.Git.Delta

-- | a delta is a source size, a destination size and a list of delta cmd
data Delta
Delta :: Word64 -> Word64 -> [DeltaCmd] -> Delta

-- | possible commands in a delta
data DeltaCmd
DeltaCopy :: ByteString -> DeltaCmd
DeltaSrc :: Word64 -> Word64 -> DeltaCmd

-- | parse a delta. format is 2 variable sizes, followed by delta cmds. for
--   each cmd: * if first byte MSB is set, we copy from source. *
--   otherwise, we copy from delta. * extensions are not handled.
deltaParse :: Parser Delta

-- | read one delta from a lazy bytestring.
deltaRead :: [ByteString] -> Maybe Delta

-- | apply a delta on a lazy bytestring, returning a new bytestring.
deltaApply :: ByteString -> Delta -> ByteString
instance GHC.Classes.Eq Data.Git.Delta.Delta
instance GHC.Show.Show Data.Git.Delta.Delta
instance GHC.Classes.Eq Data.Git.Delta.DeltaCmd
instance GHC.Show.Show Data.Git.Delta.DeltaCmd


-- | Manipulation of named references * reading packed-refs file * reading
--   single heads<i>tags</i>remote file
module Data.Git.Named

-- | Represent a named specifier.
data RefSpecTy
RefHead :: RefSpecTy
RefOrigHead :: RefSpecTy
RefFetchHead :: RefSpecTy
RefBranch :: RefName -> RefSpecTy
RefTag :: RefName -> RefSpecTy
RefRemote :: RefName -> RefSpecTy
RefPatches :: String -> RefSpecTy
RefStash :: RefSpecTy
RefOther :: String -> RefSpecTy

-- | content of a ref file.
data RefContentTy hash
RefDirect :: (Ref hash) -> RefContentTy hash
RefLink :: RefSpecTy -> RefContentTy hash
RefContentUnknown :: ByteString -> RefContentTy hash
newtype RefName
RefName :: String -> RefName
[refNameRaw] :: RefName -> String
readPackedRefs :: HashAlgorithm hash => LocalPath -> ([(RefName, Ref hash)] -> a) -> IO (PackedRefs a)
data PackedRefs a
PackedRefs :: a -> a -> a -> PackedRefs a
[packedRemotes] :: PackedRefs a -> a
[packedBranchs] :: PackedRefs a -> a
[packedTags] :: PackedRefs a -> a
existsRefFile :: LocalPath -> RefSpecTy -> IO Bool
writeRefFile :: LocalPath -> RefSpecTy -> RefContentTy hash -> IO ()
readRefFile :: HashAlgorithm hash => LocalPath -> RefSpecTy -> IO (RefContentTy hash)
looseHeadsList :: LocalPath -> IO [RefName]
looseTagsList :: LocalPath -> IO [RefName]
looseRemotesList :: LocalPath -> IO [RefName]
instance GHC.Classes.Eq (Data.Git.Named.RefContentTy hash)
instance GHC.Show.Show (Data.Git.Named.RefContentTy hash)
instance GHC.Classes.Ord Data.Git.Named.RefSpecTy
instance GHC.Classes.Eq Data.Git.Named.RefSpecTy
instance GHC.Show.Show Data.Git.Named.RefSpecTy
instance GHC.Classes.Ord Data.Git.Named.RefName
instance GHC.Classes.Eq Data.Git.Named.RefName
instance GHC.Show.Show Data.Git.Named.RefName
instance Data.String.IsString Data.Git.Named.RefName


module Data.Git.Revision

-- | A git revision. this can be many things: * a shorten ref * a ref * a
--   named branch or tag followed by optional modifiers <a>RevModifier</a>
--   that can represent: * parenting * type * date
data Revision
Revision :: String -> [RevModifier] -> Revision

-- | A modifier to a revision, which is a function apply of a revision
data RevModifier

-- | parent accessor ^<a>n</a> and ^
RevModParent :: Int -> RevModifier

-- | parent accessor ~<a>n</a>
RevModParentFirstN :: Int -> RevModifier

-- | @{type} accessor
RevModAtType :: String -> RevModifier

-- | @{date} accessor
RevModAtDate :: String -> RevModifier

-- | @{n} accessor
RevModAtN :: Int -> RevModifier

-- | Exception when a revision cannot be resolved to a reference
data RevisionNotFound
RevisionNotFound :: Revision -> RevisionNotFound
fromString :: IsString a => String -> a
instance Data.Data.Data Data.Git.Revision.RevisionNotFound
instance GHC.Classes.Eq Data.Git.Revision.RevisionNotFound
instance GHC.Show.Show Data.Git.Revision.RevisionNotFound
instance Data.Data.Data Data.Git.Revision.Revision
instance GHC.Classes.Eq Data.Git.Revision.Revision
instance Data.Data.Data Data.Git.Revision.RevModifier
instance GHC.Classes.Eq Data.Git.Revision.RevModifier
instance GHC.Base.Functor (Data.Git.Revision.Stream elem)
instance GHC.Base.Applicative (Data.Git.Revision.Stream elem)
instance GHC.Base.Alternative (Data.Git.Revision.Stream elem)
instance GHC.Base.Monad (Data.Git.Revision.Stream elem)
instance GHC.Show.Show Data.Git.Revision.Revision
instance Data.String.IsString Data.Git.Revision.Revision
instance GHC.Show.Show Data.Git.Revision.RevModifier


module Data.Git.Storage.PackIndex

-- | represent an packIndex header with the version and the fanout table
data PackIndexHeader
PackIndexHeader :: !Word32 -> !(Vector Word32) -> PackIndexHeader
data PackIndex hash
PackIndex :: Vector (Ref hash) -> Vector Word32 -> Vector Word32 -> Ref hash -> Ref hash -> PackIndex hash
[packIndexSha1s] :: PackIndex hash -> Vector (Ref hash)
[packIndexCRCs] :: PackIndex hash -> Vector Word32
[packIndexPackoffs] :: PackIndex hash -> Vector Word32
[packIndexPackChecksum] :: PackIndex hash -> Ref hash
[packIndexChecksum] :: PackIndex hash -> Ref hash

-- | open an index
packIndexOpen :: LocalPath -> Ref hash -> IO FileReader

-- | close an index
packIndexClose :: FileReader -> IO ()

-- | variant of withFile on the index file and with a FileReader
withPackIndex :: LocalPath -> Ref hash -> (FileReader -> IO a) -> IO a

-- | enumerate every indexes file in the pack directory
packIndexEnumerate :: HashAlgorithm hash => LocalPath -> IO [Ref hash]

-- | get the number of reference in this index with a specific prefix
packIndexHeaderGetNbWithPrefix :: PackIndexHeader -> Int -> Word32

-- | return the reference offset in the packfile if found
packIndexGetReferenceLocation :: HashAlgorithm hash => PackIndexHeader -> FileReader -> Ref hash -> IO (Maybe Word64)

-- | get all references that start by prefix.
packIndexGetReferencesWithPrefix :: HashAlgorithm hash => PackIndexHeader -> FileReader -> String -> IO [Ref hash]

-- | read index header from an index filereader
packIndexReadHeader :: FileReader -> IO PackIndexHeader

-- | read all index
packIndexRead :: HashAlgorithm hash => LocalPath -> Ref hash -> IO (PackIndexHeader, (Vector (Ref hash), Vector Word32, Vector Word32, [ByteString], Ref hash, Ref hash))

-- | get index header from an index reference
packIndexGetHeader :: LocalPath -> Ref hash -> IO PackIndexHeader
instance GHC.Classes.Eq Data.Git.Storage.PackIndex.PackIndexHeader
instance GHC.Show.Show Data.Git.Storage.PackIndex.PackIndexHeader


module Data.Git.Types

-- | type of a git object.
data ObjectType
TypeTree :: ObjectType
TypeBlob :: ObjectType
TypeCommit :: ObjectType
TypeTag :: ObjectType
TypeDeltaOff :: ObjectType
TypeDeltaRef :: ObjectType

-- | Represent a root tree with zero to many tree entries.
data Tree hash
Tree :: [TreeEnt hash] -> Tree hash
[treeGetEnts] :: Tree hash -> [TreeEnt hash]

-- | Represent a commit object.
data Commit hash
Commit :: Ref hash -> [Ref hash] -> Person -> Person -> Maybe ByteString -> [CommitExtra] -> ByteString -> Commit hash
[commitTreeish] :: Commit hash -> Ref hash
[commitParents] :: Commit hash -> [Ref hash]
[commitAuthor] :: Commit hash -> Person
[commitCommitter] :: Commit hash -> Person
[commitEncoding] :: Commit hash -> Maybe ByteString
[commitExtras] :: Commit hash -> [CommitExtra]
[commitMessage] :: Commit hash -> ByteString
data CommitExtra
CommitExtra :: ByteString -> ByteString -> CommitExtra
[commitExtraKey] :: CommitExtra -> ByteString
[commitExtraValue] :: CommitExtra -> ByteString

-- | Represent a binary blob.
data Blob hash
Blob :: ByteString -> Blob hash
[blobGetContent] :: Blob hash -> ByteString

-- | Represent a signed tag.
data Tag hash
Tag :: Ref hash -> ObjectType -> ByteString -> Person -> ByteString -> Tag hash
[tagRef] :: Tag hash -> Ref hash
[tagObjectType] :: Tag hash -> ObjectType
[tagBlob] :: Tag hash -> ByteString
[tagName] :: Tag hash -> Person
[tagS] :: Tag hash -> ByteString

-- | an author or committer line has the format: name <a>email</a> time
--   timezone FIXME: should be a string, but I don't know if the data is
--   stored consistantly in one encoding (UTF8)
data Person
Person :: ByteString -> ByteString -> GitTime -> Person
[personName] :: Person -> ByteString
[personEmail] :: Person -> ByteString
[personTime] :: Person -> GitTime

-- | Entity name
data EntName
entName :: ByteString -> EntName
type EntPath = [EntName]
entPathAppend :: EntPath -> EntName -> EntPath
newtype ModePerm
ModePerm :: Word32 -> ModePerm

-- | traditional unix permission for owner, group and permissions
data FilePermissions
FilePermissions :: {-# UNPACK #-} !Perm -> {-# UNPACK #-} !Perm -> {-# UNPACK #-} !Perm -> FilePermissions
[getOwnerPerm] :: FilePermissions -> {-# UNPACK #-} !Perm
[getGroupPerm] :: FilePermissions -> {-# UNPACK #-} !Perm
[getOtherPerm] :: FilePermissions -> {-# UNPACK #-} !Perm

-- | Git object file type
data ObjectFileType
FileTypeDirectory :: ObjectFileType
FileTypeRegularFile :: ObjectFileType
FileTypeSymbolicLink :: ObjectFileType
FileTypeGitLink :: ObjectFileType
getPermission :: ModePerm -> FilePermissions
getFiletype :: ModePerm -> ObjectFileType

-- | Git time is number of seconds since unix epoch in the UTC zone with
--   the current timezone associated
data GitTime
GitTime :: Elapsed -> TimezoneOffset -> GitTime
[gitTimeUTC] :: GitTime -> Elapsed
[gitTimeTimezone] :: GitTime -> TimezoneOffset
gitTime :: Integer -> Int -> GitTime
gitTimeToLocal :: GitTime -> LocalTime Elapsed

-- | Delta pointing to an offset.
data DeltaOfs hash
DeltaOfs :: Word64 -> Delta -> DeltaOfs hash

-- | Delta pointing to a ref.
data DeltaRef hash
DeltaRef :: (Ref hash) -> Delta -> DeltaRef hash

-- | represent one entry in the tree (permission,file or directory
--   name,blob or tree ref) name should maybe a filepath, but not sure
--   about the encoding.
type TreeEnt hash = (ModePerm, EntName, Ref hash)
instance GHC.Classes.Eq (Data.Git.Types.DeltaRef hash)
instance GHC.Show.Show (Data.Git.Types.DeltaRef hash)
instance GHC.Classes.Eq (Data.Git.Types.DeltaOfs hash)
instance GHC.Show.Show (Data.Git.Types.DeltaOfs hash)
instance GHC.Classes.Eq (Data.Git.Types.Tag hash)
instance GHC.Show.Show (Data.Git.Types.Tag hash)
instance GHC.Classes.Eq (Data.Git.Types.Commit hash)
instance GHC.Show.Show (Data.Git.Types.Commit hash)
instance GHC.Classes.Eq Data.Git.Types.CommitExtra
instance GHC.Show.Show Data.Git.Types.CommitExtra
instance GHC.Classes.Eq (Data.Git.Types.Blob hash)
instance GHC.Show.Show (Data.Git.Types.Blob hash)
instance GHC.Classes.Eq (Data.Git.Types.Tree hash)
instance GHC.Show.Show (Data.Git.Types.Tree hash)
instance GHC.Classes.Eq Data.Git.Types.Person
instance GHC.Show.Show Data.Git.Types.Person
instance GHC.Classes.Ord Data.Git.Types.EntName
instance GHC.Classes.Eq Data.Git.Types.EntName
instance GHC.Classes.Eq Data.Git.Types.FilePermissions
instance GHC.Show.Show Data.Git.Types.FilePermissions
instance GHC.Classes.Eq Data.Git.Types.ObjectFileType
instance GHC.Show.Show Data.Git.Types.ObjectFileType
instance GHC.Classes.Eq Data.Git.Types.ModePerm
instance GHC.Show.Show Data.Git.Types.ModePerm
instance GHC.Classes.Eq Data.Git.Types.GitTime
instance Data.Data.Data Data.Git.Types.ObjectType
instance GHC.Classes.Eq Data.Git.Types.ObjectType
instance GHC.Show.Show Data.Git.Types.ObjectType
instance GHC.Base.Monoid (Data.Git.Types.Tree hash)
instance GHC.Show.Show Data.Git.Types.EntName
instance Data.String.IsString Data.Git.Types.EntName
instance Data.Byteable.Byteable Data.Git.Types.EntName
instance Data.Hourglass.Time.Timeable Data.Git.Types.GitTime
instance Data.Hourglass.Time.Time Data.Git.Types.GitTime
instance GHC.Show.Show Data.Git.Types.GitTime
instance GHC.Enum.Enum Data.Git.Types.ObjectType


module Data.Git.Storage.Object

-- | location of an object in the database
data ObjectLocation hash
NotFound :: ObjectLocation hash
Loose :: (Ref hash) -> ObjectLocation hash
Packed :: (Ref hash) -> Word64 -> ObjectLocation hash

-- | type of a git object.
data ObjectType
TypeTree :: ObjectType
TypeBlob :: ObjectType
TypeCommit :: ObjectType
TypeTag :: ObjectType
TypeDeltaOff :: ObjectType
TypeDeltaRef :: ObjectType
type ObjectHeader hash = (ObjectType, Word64, Maybe (ObjectPtr hash))
type ObjectData = ByteString

-- | Delta objects points to some others objects in the database either as
--   offset in the pack or as a direct reference.
data ObjectPtr hash
PtrRef :: (Ref hash) -> ObjectPtr hash
PtrOfs :: Word64 -> ObjectPtr hash

-- | describe a git object, that could of 6 differents types: tree, blob,
--   commit, tag and deltas (offset or ref). the deltas one are only
--   available in packs.
data Object hash
ObjCommit :: (Commit hash) -> Object hash
ObjTag :: (Tag hash) -> Object hash
ObjBlob :: (Blob hash) -> Object hash
ObjTree :: (Tree hash) -> Object hash
ObjDeltaOfs :: (DeltaOfs hash) -> Object hash
ObjDeltaRef :: (DeltaRef hash) -> Object hash

-- | Raw objects infos have an header (type, size, ptr), the data and a
--   pointers chains to parents for resolved objects.
data ObjectInfo hash
ObjectInfo :: ObjectHeader hash -> ObjectData -> [ObjectPtr hash] -> ObjectInfo hash
[oiHeader] :: ObjectInfo hash -> ObjectHeader hash
[oiData] :: ObjectInfo hash -> ObjectData
[oiChains] :: ObjectInfo hash -> [ObjectPtr hash]
class Objectable a
getType :: Objectable a => a hash -> ObjectType
getRaw :: Objectable a => a hash -> ByteString
isDelta :: Objectable a => a hash -> Bool
toObject :: Objectable a => a hash -> Object hash
objectToType :: Object hash -> ObjectType
objectTypeMarshall :: ObjectType -> String
objectTypeUnmarshall :: ByteString -> ObjectType
objectTypeIsDelta :: ObjectType -> Bool
objectIsDelta :: Object hash -> Bool
objectToTree :: Object hash -> Maybe (Tree hash)
objectToCommit :: Object hash -> Maybe (Commit hash)
objectToTag :: Object hash -> Maybe (Tag hash)
objectToBlob :: Object hash -> Maybe (Blob hash)

-- | parse a tree content
treeParse :: HashAlgorithm hash => Parser (Tree hash)

-- | parse a commit content
commitParse :: HashAlgorithm hash => Parser (Commit hash)

-- | parse a tag content
tagParse :: HashAlgorithm hash => Parser (Tag hash)

-- | parse a blob content
blobParse :: Parser (Blob hash)
objectParseTree :: HashAlgorithm hash => Parser (Object hash)
objectParseCommit :: HashAlgorithm hash => Parser (Object hash)
objectParseTag :: HashAlgorithm hash => Parser (Object hash)
objectParseBlob :: HashAlgorithm hash => Parser (Object hash)
objectWriteHeader :: ObjectType -> Word64 -> ByteString
objectWrite :: Object hash -> ByteString
objectHash :: HashAlgorithm hash => ObjectType -> Word64 -> ByteString -> Ref hash
instance GHC.Classes.Eq (Data.Git.Storage.Object.Object hash)
instance GHC.Show.Show (Data.Git.Storage.Object.Object hash)
instance GHC.Classes.Eq (Data.Git.Storage.Object.ObjectInfo hash)
instance GHC.Show.Show (Data.Git.Storage.Object.ObjectInfo hash)
instance GHC.Classes.Eq (Data.Git.Storage.Object.ObjectPtr hash)
instance GHC.Show.Show (Data.Git.Storage.Object.ObjectPtr hash)
instance GHC.Classes.Eq (Data.Git.Storage.Object.ObjectLocation hash)
instance GHC.Show.Show (Data.Git.Storage.Object.ObjectLocation hash)
instance Data.Git.Storage.Object.Objectable Data.Git.Types.Blob
instance Data.Git.Storage.Object.Objectable Data.Git.Types.Commit
instance Data.Git.Storage.Object.Objectable Data.Git.Types.Tag
instance Data.Git.Storage.Object.Objectable Data.Git.Types.Tree
instance Data.Git.Storage.Object.Objectable Data.Git.Types.DeltaOfs
instance Data.Git.Storage.Object.Objectable Data.Git.Types.DeltaRef


module Data.Git.Storage.Pack
data PackedObjectInfo hash
PackedObjectInfo :: ObjectType -> Word64 -> Word64 -> Word64 -> Maybe (ObjectPtr hash) -> PackedObjectInfo hash
[poiType] :: PackedObjectInfo hash -> ObjectType
[poiOffset] :: PackedObjectInfo hash -> Word64
[poiSize] :: PackedObjectInfo hash -> Word64
[poiActualSize] :: PackedObjectInfo hash -> Word64
[poiExtra] :: PackedObjectInfo hash -> Maybe (ObjectPtr hash)
type PackedObjectRaw hash = (PackedObjectInfo hash, ByteString)

-- | Enumerate the pack refs available in this repository.
packEnumerate :: HashAlgorithm hash => LocalPath -> IO [Ref hash]

-- | open a pack
packOpen :: LocalPath -> Ref hash -> IO FileReader

-- | close a pack
packClose :: FileReader -> IO ()

-- | return the number of entries in this pack
packReadHeader :: LocalPath -> Ref hash -> IO Word32

-- | read an object at a specific position using a map function on the
--   objectData
packReadMapAtOffset :: HashAlgorithm hash => FileReader -> Word64 -> (ByteString -> ByteString) -> IO (Maybe (Object hash))

-- | read an object at a specific position
packReadAtOffset :: HashAlgorithm hash => FileReader -> Word64 -> IO (Maybe (Object hash))

-- | read a raw representation at a specific position
packReadRawAtOffset :: HashAlgorithm hash => FileReader -> Word64 -> IO (PackedObjectRaw hash)

-- | enumerate all objects in this pack and callback to f for reach raw
--   objects
packEnumerateObjects :: HashAlgorithm hash => LocalPath -> Ref hash -> Int -> (PackedObjectRaw hash -> IO a) -> IO ()
packedObjectToObject :: HashAlgorithm hash => (PackedObjectInfo hash, ByteString) -> Maybe (Object hash)
packObjectFromRaw :: HashAlgorithm hash => (ObjectType, Maybe (ObjectPtr hash), ByteString) -> Maybe (Object hash)
instance GHC.Classes.Eq (Data.Git.Storage.Pack.PackedObjectInfo hash)
instance GHC.Show.Show (Data.Git.Storage.Pack.PackedObjectInfo hash)


module Data.Git.Storage.Loose
newtype Zipped
Zipped :: ByteString -> Zipped
[getZippedData] :: Zipped -> ByteString

-- | unmarshall an object (with header) from a bytestring.
looseUnmarshall :: HashAlgorithm hash => ByteString -> Object hash

-- | unmarshall an object as (header, data) tuple from a bytestring
looseUnmarshallRaw :: ByteString -> (ObjectHeader hash, ObjectData)

-- | unmarshall an object (with header) from a zipped stream.
looseUnmarshallZipped :: HashAlgorithm hash => Zipped -> Object hash

-- | unmarshall an object as (header, data) tuple from a zipped stream
looseUnmarshallZippedRaw :: Zipped -> (ObjectHeader hash, ObjectData)

-- | marshall as lazy bytestring an object except deltas.
looseMarshall :: Object hash -> ByteString

-- | read a specific ref from a loose object and returns an object
looseRead :: HashAlgorithm hash => LocalPath -> Ref hash -> IO (Object hash)

-- | read only the header of a loose object.
looseReadHeader :: HashAlgorithm hash => LocalPath -> Ref hash -> IO (ObjectHeader hash)

-- | read a specific ref from a loose object and returns an header and
--   data.
looseReadRaw :: HashAlgorithm hash => LocalPath -> Ref hash -> IO (ObjectHeader hash, ObjectData)

-- | check if a specific ref exists as loose object
looseExists :: HashAlgorithm hash => LocalPath -> Ref hash -> IO Bool

-- | create a new blob on a temporary location and on success move it to
--   the object store with its digest name.
looseWriteBlobFromFile :: HashAlgorithm hash => LocalPath -> LocalPath -> IO (Ref hash)

-- | write an object to disk as a loose reference. use
--   looseWriteBlobFromFile for efficiently writing blobs when being
--   commited from a file.
looseWrite :: HashAlgorithm hash => LocalPath -> Object hash -> IO (Ref hash)

-- | enumarate all prefixes available in the object store.
looseEnumeratePrefixes :: LocalPath -> IO [[Char]]

-- | enumerate all references available with a specific prefix.
looseEnumerateWithPrefixFilter :: HashAlgorithm hash => LocalPath -> String -> (Ref hash -> Bool) -> IO [Ref hash]
looseEnumerateWithPrefix :: HashAlgorithm hash => LocalPath -> String -> IO [Ref hash]
instance GHC.Classes.Eq Data.Git.Storage.Loose.Zipped
instance GHC.Show.Show Data.Git.Storage.Loose.Zipped


module Data.Git.Storage

-- | represent a git repo, with possibly already opened filereaders for
--   indexes and packs
data Git hash
packedNamed :: Git hash -> CachedPackedRef hash
gitRepoPath :: Git hash -> LocalPath
configs :: Git hash -> IORef [Config]

-- | open a new git repository context
openRepo :: LocalPath -> IO (Git SHA1)

-- | close a git repository context, closing all remaining fileReaders.
closeRepo :: Git hash -> IO ()

-- | execute a function f with a git context.
withRepo :: LocalPath -> (Git SHA1 -> IO c) -> IO c

-- | execute a function on the current repository.
--   
--   check findRepo to see how the git repository is found.
withCurrentRepo :: (Git SHA1 -> IO a) -> IO a

-- | Find the git repository from the current directory.
--   
--   If the environment variable GIT_DIR is set then it's used, otherwise
--   iterate from current directory, up to 128 parents for a .git directory
findRepoMaybe :: IO (Maybe LocalPath)

-- | Find the git repository from the current directory.
--   
--   If the environment variable GIT_DIR is set then it's used, otherwise
--   iterate from current directory, up to 128 parents for a .git directory
findRepo :: IO LocalPath

-- | basic checks to see if a specific path looks like a git repo.
isRepo :: LocalPath -> IO Bool

-- | initialize a new repository at a specific location.
initRepo :: LocalPath -> IO ()

-- | read the repository's description
getDescription :: Git hash -> IO (Maybe String)

-- | set the repository's description
setDescription :: Git hash -> String -> IO ()
iterateIndexes :: HashAlgorithm hash => Git hash -> (b -> (Ref hash, PackIndexReader) -> IO (b, Bool)) -> b -> IO b

-- | Get the object location of a specific reference
findReference :: HashAlgorithm hash => Git hash -> Ref hash -> IO (ObjectLocation hash)

-- | get all the references that start by a specific prefix
findReferencesWithPrefix :: HashAlgorithm hash => Git hash -> String -> IO [Ref hash]

-- | get an object from repository
getObjectRaw :: HashAlgorithm hash => Git hash -> Ref hash -> Bool -> IO (Maybe (ObjectInfo hash))

-- | get an object from repository
getObjectRawAt :: HashAlgorithm hash => Git hash -> ObjectLocation hash -> Bool -> IO (Maybe (ObjectInfo hash))

-- | get an object from repository using a ref.
getObject :: HashAlgorithm hash => Git hash -> Ref hash -> Bool -> IO (Maybe (Object hash))

-- | Just like <a>getObject</a> but will raise a RefNotFound exception if
--   the reference cannot be found.
getObject_ :: (Typeable hash, HashAlgorithm hash) => Git hash -> Ref hash -> Bool -> IO (Object hash)

-- | get an object from repository using a location to reference it.
getObjectAt :: HashAlgorithm hash => Git hash -> ObjectLocation hash -> Bool -> IO (Maybe (Object hash))

-- | get an object type from repository
getObjectType :: HashAlgorithm hash => Git hash -> Ref hash -> IO (Maybe ObjectType)

-- | set an object in the store and returns the new ref this is always
--   going to create a loose object.
setObject :: HashAlgorithm hash => Git hash -> Object hash -> IO (Ref hash)


module Data.Git.Repository

-- | represent a git repo, with possibly already opened filereaders for
--   indexes and packs
data Git hash

-- | Read the Config
configGetAll :: Git hash -> IO [Config]

-- | Get a configuration element from the config file, starting from the
--   local repository config file, then the global config file.
--   
--   for example the equivalent to git config user.name is:
--   
--   <pre>
--   configGet git "user" "name"
--   </pre>
configGet :: Git hash -> String -> String -> IO (Maybe String)
newtype Config
Config :: [Section] -> Config
data Section
Section :: String -> [(String, String)] -> Section
[sectionName] :: Section -> String
[sectionKVs] :: Section -> [(String, String)]
type HTree hash = [(ModePerm, EntName, HTreeEnt hash)]

-- | hierarchy tree, either a reference to a blob (file) or a tree
--   (directory).
data HTreeEnt hash
TreeDir :: (Ref hash) -> (HTree hash) -> HTreeEnt hash
TreeFile :: (Ref hash) -> HTreeEnt hash
newtype RefName
RefName :: String -> RefName
[refNameRaw] :: RefName -> String

-- | get a specified commit
getCommitMaybe :: HashAlgorithm hash => Git hash -> Ref hash -> IO (Maybe (Commit hash))

-- | get a specified commit but raises an exception if doesn't exists or
--   type is not appropriate
getCommit :: (Typeable hash, HashAlgorithm hash) => Git hash -> Ref hash -> IO (Commit hash)

-- | get a specified tree
getTreeMaybe :: HashAlgorithm hash => Git hash -> Ref hash -> IO (Maybe (Tree hash))

-- | get a specified tree but raise
getTree :: (Typeable hash, HashAlgorithm hash) => Git hash -> Ref hash -> IO (Tree hash)

-- | Rewrite a set of commits from a revision and returns the new ref.
--   
--   If during revision traversal (diving) there's a commit with zero or
--   multiple parents then the traversal will stop regardless of the amount
--   of parent requested.
--   
--   calling "rewrite f 2 (revisionOf d)" on the following tree:
--   
--   a &lt;-- b &lt;-- c &lt;-- d
--   
--   result in the following tree after mapping with f:
--   
--   a &lt;-- f(b) &lt;-- f(c) &lt;-- f(d)
rewrite :: (Typeable hash, HashAlgorithm hash) => Git hash -> (Commit hash -> IO (Commit hash)) -> Revision -> Int -> IO (Ref hash)

-- | build a hierarchy tree from a tree object
buildHTree :: (Typeable hash, HashAlgorithm hash) => Git hash -> Tree hash -> IO (HTree hash)

-- | resolve the ref (tree or blob) related to a path at a specific commit
--   ref
resolvePath :: (Typeable hash, HashAlgorithm hash) => Git hash -> Ref hash -> EntPath -> IO (Maybe (Ref hash))

-- | returns a tree from a ref that might be either a commit, a tree or a
--   tag.
resolveTreeish :: HashAlgorithm hash => Git hash -> Ref hash -> IO (Maybe (Tree hash))

-- | try to resolve a string to a specific commit ref for example: HEAD,
--   HEAD^, master~3, shortRef
resolveRevision :: (Typeable hash, HashAlgorithm hash) => Git hash -> Revision -> IO (Maybe (Ref hash))

-- | initialize a new repository at a specific location.
initRepo :: LocalPath -> IO ()

-- | basic checks to see if a specific path looks like a git repo.
isRepo :: LocalPath -> IO Bool

-- | Write a branch to point to a specific reference
branchWrite :: Git hash -> RefName -> Ref hash -> IO ()

-- | Return the list of branches
branchList :: Git hash -> IO (Set RefName)

-- | Write a tag to point to a specific reference
tagWrite :: Git hash -> RefName -> Ref hash -> IO ()

-- | Return the list of branches
tagList :: Git hash -> IO (Set RefName)

-- | Set head to point to either a reference or a branch name.
headSet :: Git hash -> Either (Ref hash) RefName -> IO ()

-- | Get what the head is pointing to, or the reference otherwise
headGet :: HashAlgorithm hash => Git hash -> IO (Either (Ref hash) RefName)
instance GHC.Classes.Eq (Data.Git.Repository.InvalidType hash)
instance GHC.Show.Show (Data.Git.Repository.InvalidType hash)
instance Data.Typeable.Internal.Typeable hash => GHC.Exception.Exception (Data.Git.Repository.InvalidType hash)


module Data.Git

-- | represent a git reference (SHA1)
data Ref hash
newtype RefName
RefName :: String -> RefName
[refNameRaw] :: RefName -> String

-- | Represent a commit object.
data Commit hash
Commit :: Ref hash -> [Ref hash] -> Person -> Person -> Maybe ByteString -> [CommitExtra] -> ByteString -> Commit hash
[commitTreeish] :: Commit hash -> Ref hash
[commitParents] :: Commit hash -> [Ref hash]
[commitAuthor] :: Commit hash -> Person
[commitCommitter] :: Commit hash -> Person
[commitEncoding] :: Commit hash -> Maybe ByteString
[commitExtras] :: Commit hash -> [CommitExtra]
[commitMessage] :: Commit hash -> ByteString

-- | an author or committer line has the format: name <a>email</a> time
--   timezone FIXME: should be a string, but I don't know if the data is
--   stored consistantly in one encoding (UTF8)
data Person
Person :: ByteString -> ByteString -> GitTime -> Person
[personName] :: Person -> ByteString
[personEmail] :: Person -> ByteString
[personTime] :: Person -> GitTime
data CommitExtra
CommitExtra :: ByteString -> ByteString -> CommitExtra
[commitExtraKey] :: CommitExtra -> ByteString
[commitExtraValue] :: CommitExtra -> ByteString

-- | Represent a root tree with zero to many tree entries.
data Tree hash
Tree :: [TreeEnt hash] -> Tree hash
[treeGetEnts] :: Tree hash -> [TreeEnt hash]

-- | Represent a binary blob.
data Blob hash
Blob :: ByteString -> Blob hash
[blobGetContent] :: Blob hash -> ByteString

-- | Represent a signed tag.
data Tag hash
Tag :: Ref hash -> ObjectType -> ByteString -> Person -> ByteString -> Tag hash
[tagRef] :: Tag hash -> Ref hash
[tagObjectType] :: Tag hash -> ObjectType
[tagBlob] :: Tag hash -> ByteString
[tagName] :: Tag hash -> Person
[tagS] :: Tag hash -> ByteString

-- | Git time is number of seconds since unix epoch in the UTC zone with
--   the current timezone associated
data GitTime
newtype ModePerm
ModePerm :: Word32 -> ModePerm

-- | Entity name
data EntName
type EntPath = [EntName]
entName :: ByteString -> EntName
entPathAppend :: EntPath -> EntName -> EntPath

-- | Git object file type
data ObjectFileType
FileTypeDirectory :: ObjectFileType
FileTypeRegularFile :: ObjectFileType
FileTypeSymbolicLink :: ObjectFileType
FileTypeGitLink :: ObjectFileType

-- | traditional unix permission for owner, group and permissions
data FilePermissions
FilePermissions :: {-# UNPACK #-} !Perm -> {-# UNPACK #-} !Perm -> {-# UNPACK #-} !Perm -> FilePermissions
[getOwnerPerm] :: FilePermissions -> {-# UNPACK #-} !Perm
[getGroupPerm] :: FilePermissions -> {-# UNPACK #-} !Perm
[getOtherPerm] :: FilePermissions -> {-# UNPACK #-} !Perm
getPermission :: ModePerm -> FilePermissions
getFiletype :: ModePerm -> ObjectFileType

-- | A git revision. this can be many things: * a shorten ref * a ref * a
--   named branch or tag followed by optional modifiers <a>RevModifier</a>
--   that can represent: * parenting * type * date
data Revision

-- | try to resolve a string to a specific commit ref for example: HEAD,
--   HEAD^, master~3, shortRef
resolveRevision :: (Typeable hash, HashAlgorithm hash) => Git hash -> Revision -> IO (Maybe (Ref hash))

-- | returns a tree from a ref that might be either a commit, a tree or a
--   tag.
resolveTreeish :: HashAlgorithm hash => Git hash -> Ref hash -> IO (Maybe (Tree hash))

-- | resolve the ref (tree or blob) related to a path at a specific commit
--   ref
resolvePath :: (Typeable hash, HashAlgorithm hash) => Git hash -> Ref hash -> EntPath -> IO (Maybe (Ref hash))

-- | represent a git repo, with possibly already opened filereaders for
--   indexes and packs
data Git hash

-- | execute a function on the current repository.
--   
--   check findRepo to see how the git repository is found.
withCurrentRepo :: (Git SHA1 -> IO a) -> IO a

-- | execute a function f with a git context.
withRepo :: LocalPath -> (Git SHA1 -> IO c) -> IO c

-- | Find the git repository from the current directory.
--   
--   If the environment variable GIT_DIR is set then it's used, otherwise
--   iterate from current directory, up to 128 parents for a .git directory
findRepo :: IO LocalPath

-- | initialize a new repository at a specific location.
initRepo :: LocalPath -> IO ()

-- | basic checks to see if a specific path looks like a git repo.
isRepo :: LocalPath -> IO Bool

-- | Rewrite a set of commits from a revision and returns the new ref.
--   
--   If during revision traversal (diving) there's a commit with zero or
--   multiple parents then the traversal will stop regardless of the amount
--   of parent requested.
--   
--   calling "rewrite f 2 (revisionOf d)" on the following tree:
--   
--   a &lt;-- b &lt;-- c &lt;-- d
--   
--   result in the following tree after mapping with f:
--   
--   a &lt;-- f(b) &lt;-- f(c) &lt;-- f(d)
rewrite :: (Typeable hash, HashAlgorithm hash) => Git hash -> (Commit hash -> IO (Commit hash)) -> Revision -> Int -> IO (Ref hash)

-- | get an object from repository using a ref.
getObject :: HashAlgorithm hash => Git hash -> Ref hash -> Bool -> IO (Maybe (Object hash))

-- | get a specified commit but raises an exception if doesn't exists or
--   type is not appropriate
getCommit :: (Typeable hash, HashAlgorithm hash) => Git hash -> Ref hash -> IO (Commit hash)

-- | get a specified tree but raise
getTree :: (Typeable hash, HashAlgorithm hash) => Git hash -> Ref hash -> IO (Tree hash)

-- | set an object in the store and returns the new ref this is always
--   going to create a loose object.
setObject :: HashAlgorithm hash => Git hash -> Object hash -> IO (Ref hash)
toObject :: Objectable a => a hash -> Object hash
type WorkTree hash = MVar (TreeSt hash)
data EntType
EntDirectory :: EntType
EntFile :: EntType
EntExecutable :: EntType

-- | Create a new worktree
workTreeNew :: IO (WorkTree hash)

-- | Create a worktree from a tree reference.
workTreeFrom :: Ref hash -> IO (WorkTree hash)

-- | delete a path from a working tree
--   
--   if the path doesn't exist, no error is raised
workTreeDelete :: (Typeable hash, HashAlgorithm hash) => Git hash -> WorkTree hash -> EntPath -> IO ()

-- | Set a file in this working tree to a specific ref.
--   
--   The ref should point to a valid blob or tree object, and it's safer to
--   write the referenced tree or blob object first.
workTreeSet :: (Typeable hash, HashAlgorithm hash) => Git hash -> WorkTree hash -> EntPath -> (EntType, Ref hash) -> IO ()

-- | Flush the worktree by creating all the necessary trees in the git
--   store and return the root ref of the work tree.
workTreeFlush :: HashAlgorithm hash => Git hash -> WorkTree hash -> IO (Ref hash)

-- | Write a branch to point to a specific reference
branchWrite :: Git hash -> RefName -> Ref hash -> IO ()

-- | Return the list of branches
branchList :: Git hash -> IO (Set RefName)

-- | Write a tag to point to a specific reference
tagWrite :: Git hash -> RefName -> Ref hash -> IO ()

-- | Return the list of branches
tagList :: Git hash -> IO (Set RefName)

-- | Set head to point to either a reference or a branch name.
headSet :: Git hash -> Either (Ref hash) RefName -> IO ()

-- | Get what the head is pointing to, or the reference otherwise
headGet :: HashAlgorithm hash => Git hash -> IO (Either (Ref hash) RefName)


-- | Simplifies the Git operation presents in this package.
--   
--   You can easily access to the usual Git general informations:
--   
--   <ul>
--   <li>access to Head, Branches or Tags</li>
--   <li>direct access to a Commit</li>
--   </ul>
--   
--   This module also defines a convenient Monad to access the whole
--   information from a Commit: see <tt>CommitAccessMonad</tt> and
--   <a>withCommit</a>.
--   
--   You can also easily create a new commit: see <a>CommitM</a> and
--   <a>withNewCommit</a>
module Data.Git.Monad

-- | Basic operations common between the different Monads defined in this
--   package.
class (Functor m, Applicative m, Monad m) => GitMonad m

-- | the current Monad must allow access to the current Git
getGit :: GitMonad m => m (Git SHA1)
liftGit :: GitMonad m => IO a -> m a
data GitM a
withRepo :: LocalPath -> GitM a -> IO (Either String a)
withCurrentRepo :: GitM a -> IO (Either String a)

-- | this is a convenient class to allow a common interface for what user
--   may need to optain a Ref from a given Resolvable object.
--   
--   each of this instances is a convenient implementation of what a user
--   would have to do in order to resolve a branch, a tag or a String.
--   
--   <pre>
--   resolve (Ref "2ad98b90...2ca") === Ref "2ad98b90...2ca"
--   resolve "master"
--   resolve "HEAD^^^"
--   </pre>
class Resolvable rev
resolve :: (Resolvable rev, GitMonad m) => rev -> m (Maybe (Ref SHA1))
branchList :: GitMonad git => git (Set RefName)
branchWrite :: GitMonad git => RefName -> Ref SHA1 -> git ()
tagList :: GitMonad git => git (Set RefName)
tagWrite :: GitMonad git => RefName -> Ref SHA1 -> git ()
headGet :: GitMonad git => git (Either (Ref SHA1) RefName)
headResolv :: GitMonad git => git (Maybe (Ref SHA1))
headSet :: GitMonad git => Either (Ref SHA1) RefName -> git ()
getCommit :: (GitMonad git, Resolvable ref) => ref -> git (Maybe (Commit SHA1))

-- | ReadOnly operations on a given commit
data CommitAccessM a

-- | open a commit in the current GitMonad
--   
--   Read commit's info (Author, Committer, message...) or Commit's Tree.
--   
--   <pre>
--   withCurrentRepo $
--      withCommit "master" $ do
--          -- print the commit's author information
--          author &lt;- getAuthor
--          liftGit $ print author
--   
--          -- print the list of files|dirs in the root directory
--          l &lt;- getDir []
--          liftGit $ print l
--   </pre>
withCommit :: (Resolvable ref, GitMonad git) => ref -> CommitAccessM a -> git a
getAuthor :: CommitAccessM Person
getCommitter :: CommitAccessM Person
getParents :: CommitAccessM [Ref SHA1]
getExtras :: CommitAccessM [CommitExtra]
getEncoding :: CommitAccessM (Maybe ByteString)
getMessage :: CommitAccessM ByteString

-- | get the content of the file at the given Path
--   
--   if the given Path is not a file or does not exist, the function
--   returns Nothing.
getFile :: EntPath -> CommitAccessM (Maybe ByteString)

-- | list the element present in the Given Directory Path
--   
--   if the given Path is not a directory or does not exist, the function
--   returns Nothing.
getDir :: EntPath -> CommitAccessM (Maybe [EntName])
data CommitM a

-- | create a new commit in the current GitMonad
--   
--   The commit is pre-filled with the following default values:
--   
--   <ul>
--   <li>author and committer are the same</li>
--   <li>the commit's parents is an empty list</li>
--   <li>there is no commit encoding</li>
--   <li>the commit's extras is an empty list</li>
--   <li>the commit message is an empty ByteString</li>
--   <li>the working tree is a new empty Tree or the Tree associated to the
--   given Revision or Ref.</li>
--   </ul>
--   
--   You can update these values with the commit setters (setFile,
--   setAuthor...)
--   
--   Example:
--   
--   <pre>
--   withCurrentRepo $
--      (r, ()) &lt;- withNewCommit person Nothing $ do
--          setMessage "inital commit"
--          setFile ["README.md"] "# My awesome project\n\nthis is a new project\n"
--      branchWrite "master" r
--   </pre>
--   
--   you can also continue the work on a same branch. In this case the
--   commit's parent is already set to the Reference associated to the
--   revision. You can, change the parents if you wish to erase, or
--   replace, this value.
--   
--   <pre>
--   withCurrentRepo $
--      readmeContent &lt;- withCommit (Just "master") $ getFile ["README.md"]
--      (r, ()) &lt;- withNewCommit person (Just "master") $ do
--          setMessage "update the README"
--          setFile ["README.md"] $ readmeContent &lt;&gt; "just add some more description\n"
--      branchWrite "master" r
--   </pre>
withNewCommit :: (GitMonad git, Resolvable rev) => Person -> Maybe rev -> CommitM a -> git (Ref SHA1, a)

-- | create or continue to work on a branch
--   
--   This is a convenient function to create or to linearily work on a
--   branch. This function applies a first Collect of information on the
--   parent commit (the actual branch's commit). Then it creates a new
--   commit and update the branch to point to this commit.
--   
--   for example:
--   
--   <pre>
--   withCurrentRepo $
--       withBranch person "master" True
--           (getAuthor)
--           (maybe (setMessage "initial commit on this branch")
--                  (author -&gt; setMessage $ "continue the great work of " ++ show (personName author))
--           )
--   </pre>
withBranch :: GitMonad git => Person -> RefName -> Bool -> (CommitAccessM a) -> (Maybe a -> CommitM b) -> git (Ref SHA1, b)

-- | replace the Commit's Author
setAuthor :: Person -> CommitM ()

-- | replace the Commit's Committer
setCommitter :: Person -> CommitM ()

-- | replace the Commit's Parents
setParents :: [Ref SHA1] -> CommitM ()

-- | replace the Commit's Extras
setExtras :: [CommitExtra] -> CommitM ()

-- | replace the Commit's encoding
setEncoding :: Maybe ByteString -> CommitM ()

-- | replace the Commit's message with the new given message.
setMessage :: ByteString -> CommitM ()

-- | add a new file in in the Commit's Working Tree
setFile :: EntPath -> ByteString -> CommitM ()

-- | delete a file from the Commit's Working Tree.
deleteFile :: EntPath -> CommitM ()

-- | represent a git repo, with possibly already opened filereaders for
--   indexes and packs
data Git hash

-- | represent a git reference (SHA1)
data Ref hash
newtype RefName
RefName :: String -> RefName
[refNameRaw] :: RefName -> String

-- | Represent a commit object.
data Commit hash
Commit :: Ref hash -> [Ref hash] -> Person -> Person -> Maybe ByteString -> [CommitExtra] -> ByteString -> Commit hash
[commitTreeish] :: Commit hash -> Ref hash
[commitParents] :: Commit hash -> [Ref hash]
[commitAuthor] :: Commit hash -> Person
[commitCommitter] :: Commit hash -> Person
[commitEncoding] :: Commit hash -> Maybe ByteString
[commitExtras] :: Commit hash -> [CommitExtra]
[commitMessage] :: Commit hash -> ByteString

-- | an author or committer line has the format: name <a>email</a> time
--   timezone FIXME: should be a string, but I don't know if the data is
--   stored consistantly in one encoding (UTF8)
data Person
Person :: ByteString -> ByteString -> GitTime -> Person
[personName] :: Person -> ByteString
[personEmail] :: Person -> ByteString
[personTime] :: Person -> GitTime
instance GHC.Base.Functor Data.Git.Monad.CommitM
instance GHC.Base.Applicative Data.Git.Monad.CommitM
instance GHC.Base.Monad Data.Git.Monad.CommitM
instance Data.Git.Monad.GitMonad Data.Git.Monad.CommitM
instance GHC.Base.Functor Data.Git.Monad.CommitAccessM
instance GHC.Base.Applicative Data.Git.Monad.CommitAccessM
instance GHC.Base.Monad Data.Git.Monad.CommitAccessM
instance Data.Git.Monad.GitMonad Data.Git.Monad.CommitAccessM
instance GHC.Base.Functor Data.Git.Monad.GitM
instance GHC.Base.Applicative Data.Git.Monad.GitM
instance GHC.Base.Monad Data.Git.Monad.GitM
instance Data.Git.Monad.GitMonad Data.Git.Monad.GitM
instance Data.Git.Monad.Resolvable (Data.Git.Ref.Ref Crypto.Hash.SHA1.SHA1)
instance Data.Git.Monad.Resolvable Data.Git.Revision.Revision
instance Data.Git.Monad.Resolvable GHC.Base.String
instance Data.Git.Monad.Resolvable Data.Git.Named.RefName


-- | Basic Git diff methods.
module Data.Git.Diff

-- | represents a blob's content (i.e., the content of a file at a given
--   reference).
data BlobContent

-- | Text file's lines
FileContent :: [ByteString] -> BlobContent

-- | Binary content
BinaryContent :: ByteString -> BlobContent

-- | This is a blob description at a given state (revision)
data BlobState hash
BlobState :: EntPath -> ModePerm -> Ref hash -> BlobContent -> BlobState hash
[bsFilename] :: BlobState hash -> EntPath
[bsMode] :: BlobState hash -> ModePerm
[bsRef] :: BlobState hash -> Ref hash
[bsContent] :: BlobState hash -> BlobContent

-- | Represents a file state between two revisions A file (a blob) can be
--   present in the first Tree's revision but not in the second one, then
--   it has been deleted. If only in the second Tree's revision, then it
--   has been created. If it is in the both, maybe it has been changed.
data BlobStateDiff hash
OnlyOld :: (BlobState hash) -> BlobStateDiff hash
OnlyNew :: (BlobState hash) -> BlobStateDiff hash
OldAndNew :: (BlobState hash) -> (BlobState hash) -> BlobStateDiff hash

-- | generate a diff list between two revisions with a given diff helper.
--   
--   Useful to extract any kind of information from two different
--   revisions. For example you can get the number of deleted files:
--   
--   <pre>
--   getdiffwith f 0 head^ head git
--       where f (OnlyOld _) acc = acc+1
--             f _           acc = acc
--   </pre>
--   
--   Or save the list of new files:
--   
--   <pre>
--   getdiffwith f [] head^ head git
--       where f (OnlyNew bs) acc = (bsFilename bs):acc
--             f _            acc = acc
--   </pre>
getDiffWith :: (Typeable hash, HashAlgorithm hash) => (BlobStateDiff hash -> a -> a) -> a -> Ref hash -> Ref hash -> Git hash -> IO a

-- | This is a proposed diff records for a given file. It contains useful
--   information: * the filename (with its path in the root project) * a
--   file diff (with the Data.Algorithm.Patience method) * the file's mode
--   (i.e. the file priviledge) * the file's ref
data GitDiff hash
GitDiff :: EntPath -> GitFileContent -> GitFileMode -> GitFileRef hash -> GitDiff hash
[hFileName] :: GitDiff hash -> EntPath
[hFileContent] :: GitDiff hash -> GitFileContent
[hFileMode] :: GitDiff hash -> GitFileMode
[hFileRef] :: GitDiff hash -> GitFileRef hash
data GitFileContent
NewBinaryFile :: GitFileContent
OldBinaryFile :: GitFileContent
NewTextFile :: [TextLine] -> GitFileContent
OldTextFile :: [TextLine] -> GitFileContent
ModifiedBinaryFile :: GitFileContent
ModifiedFile :: [FilteredDiff] -> GitFileContent
UnModifiedFile :: GitFileContent
data FilteredDiff
NormalLine :: (Item TextLine) -> FilteredDiff
Separator :: FilteredDiff
data GitFileRef hash
NewRef :: (Ref hash) -> GitFileRef hash
OldRef :: (Ref hash) -> GitFileRef hash
ModifiedRef :: (Ref hash) -> (Ref hash) -> GitFileRef hash
UnModifiedRef :: (Ref hash) -> GitFileRef hash
data GitFileMode
NewMode :: ModePerm -> GitFileMode
OldMode :: ModePerm -> GitFileMode
ModifiedMode :: ModePerm -> ModePerm -> GitFileMode
UnModifiedMode :: ModePerm -> GitFileMode
data TextLine
TextLine :: Integer -> ByteString -> TextLine
[lineNumber] :: TextLine -> Integer
[lineContent] :: TextLine -> ByteString

-- | A default diff helper. It is an example about how you can write your
--   own diff helper or you can use it if you want to get all of
--   differences.
defaultDiff :: Int -> BlobStateDiff hash -> [GitDiff hash] -> [GitDiff hash]

-- | A default Diff getter which returns all diff information (Mode,
--   Content and Binary) with a context of 5 lines.
--   
--   <pre>
--   getDiff = getDiffWith (defaultDiff 5) []
--   </pre>
getDiff :: (Typeable hash, HashAlgorithm hash) => Ref hash -> Ref hash -> Git hash -> IO [GitDiff hash]
instance GHC.Show.Show (Data.Git.Diff.BlobState hash)
instance GHC.Show.Show Data.Git.Diff.BlobContent
instance GHC.Classes.Eq Data.Git.Diff.TextLine
instance GHC.Classes.Ord Data.Git.Diff.TextLine
instance GHC.Classes.Eq (Data.Git.Diff.BlobState hash)
