-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Git operations -- -- Provides low level git operations @package hit @version 0.2.1 module Data.Git.Revision data Revision Revision :: String -> [RevModifier] -> Revision data RevModifier -- | parent accessor ^n and ^ RevModParent :: Int -> RevModifier -- | parent accessor ~n RevModParentFirstN :: Int -> RevModifier RevModAtType :: String -> RevModifier RevModAtDate :: String -> RevModifier RevModAtN :: Int -> RevModifier revFromString :: Stream s Identity Char => s -> Revision instance Eq RevModifier instance Eq Revision 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 deltaParse :: Parser ByteString Delta deltaRead :: ByteString -> Maybe Delta -- | 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. -- -- read one delta from a lazy bytestring. -- -- apply a delta on a lazy bytestring, returning a new bytestring. deltaApply :: ByteString -> Delta -> ByteString instance Show DeltaCmd instance Eq DeltaCmd instance Show Delta instance Eq Delta module Data.Git.Ref -- | represent a git reference (SHA1) data Ref isHex :: ByteString -> Bool isHexString :: [Char] -> Bool -- | take a hexadecimal bytestring that represent a reference and turn into -- a ref fromHex :: ByteString -> Ref -- | take a hexadecimal string that represent a reference and turn into a -- ref fromHexString :: String -> Ref -- | transform a bytestring that represent a binary bytestring and returns -- a ref. fromBinary :: ByteString -> Ref -- | turn a reference into a binary bytestring toBinary :: Ref -> ByteString -- | transform a ref into an hexadecimal bytestring toHex :: Ref -> ByteString -- | transform a ref into an hexadecimal string toHexString :: Ref -> String -- | returns the prefix (leading byte) of this reference refPrefix :: Ref -> Int -- | compare prefix cmpPrefix :: String -> Ref -> Ordering -- | returns the splitted format prefix/suffix for addressing the -- loose object database toFilePathParts :: Ref -> (String, String) hash :: ByteString -> Ref hashLBS :: ByteString -> Ref instance Eq Ref instance Ord Ref instance Show Ref module Data.Git.Object -- | location of an object in the database data ObjectLocation NotFound :: ObjectLocation Loose :: Ref -> ObjectLocation Packed :: Ref -> Word64 -> ObjectLocation -- | type of a git object. data ObjectType TypeTree :: ObjectType TypeBlob :: ObjectType TypeCommit :: ObjectType TypeTag :: ObjectType TypeDeltaOff :: ObjectType TypeDeltaRef :: ObjectType type ObjectHeader = (ObjectType, Word64, Maybe ObjectPtr) 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 PtrRef :: Ref -> ObjectPtr PtrOfs :: Word64 -> ObjectPtr -- | 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 through packs. data Object Object :: a -> Object data Tree Tree :: [TreeEnt] -> Tree treeGetEnts :: Tree -> [TreeEnt] data Commit Commit :: Ref -> [Ref] -> Name -> Name -> ByteString -> Commit commitTreeish :: Commit -> Ref commitParents :: Commit -> [Ref] commitAuthor :: Commit -> Name commitCommitter :: Commit -> Name commitMessage :: Commit -> ByteString data Blob Blob :: ByteString -> Blob blobGetContent :: Blob -> ByteString data Tag Tag :: Ref -> ObjectType -> ByteString -> Name -> ByteString -> Tag tagRef :: Tag -> Ref tagObjectType :: Tag -> ObjectType tagBlob :: Tag -> ByteString tagName :: Tag -> Name tagS :: Tag -> ByteString data DeltaOfs DeltaOfs :: Word64 -> Delta -> DeltaOfs data DeltaRef DeltaRef :: Ref -> Delta -> DeltaRef -- | Raw objects infos have an header (type, size, ptr), the data and a -- pointers chains to parents for resolved objects. data ObjectInfo ObjectInfo :: ObjectHeader -> ObjectData -> [ObjectPtr] -> ObjectInfo oiHeader :: ObjectInfo -> ObjectHeader oiData :: ObjectInfo -> ObjectData oiChains :: ObjectInfo -> [ObjectPtr] objectWrap :: Objectable a => a -> Object objectToType :: Object -> ObjectType objectTypeMarshall :: ObjectType -> String objectTypeUnmarshall :: String -> ObjectType objectTypeIsDelta :: ObjectType -> Bool objectIsDelta :: Object -> Bool objectToTree :: Object -> Maybe Tree objectToCommit :: Object -> Maybe Commit objectToTag :: Object -> Maybe Tag objectToBlob :: Object -> Maybe Blob treeParse :: Parser ByteString Tree commitParse :: Parser ByteString Commit tagParse :: Parser ByteString Tag blobParse :: Parser ByteString Blob objectParseTree :: Parser ByteString Object objectParseCommit :: Parser ByteString Object objectParseTag :: Parser ByteString Object objectParseBlob :: Parser ByteString Object -- | parse a tree content -- -- parse a blob content -- -- parse a commit content -- -- parse a tag content objectWriteHeader :: ObjectType -> Word64 -> ByteString objectWrite :: Object -> ByteString objectHash :: ObjectType -> Word64 -> ByteString -> Ref instance Show ObjectLocation instance Eq ObjectLocation instance Show ObjectType instance Eq ObjectType instance Show ObjectPtr instance Eq ObjectPtr instance Show ObjectInfo instance Eq ObjectInfo instance Show Tree instance Eq Tree instance Show Blob instance Eq Blob instance Show Commit instance Eq Commit instance Show Tag instance Eq Tag instance Show DeltaOfs instance Eq DeltaOfs instance Show DeltaRef instance Eq DeltaRef instance Objectable DeltaRef instance Objectable DeltaOfs instance Objectable Tree instance Objectable Tag instance Objectable Commit instance Objectable Blob instance Enum ObjectType module Data.Git.Loose -- | unmarshall an object (with header) from a lazy bytestring. looseUnmarshall :: ByteString -> Object -- | unmarshall an object as (header, data) tuple from a lazy bytestring. looseUnmarshallRaw :: ByteString -> (ObjectHeader, ObjectData) looseMarshall :: Object -> ByteString looseRead :: FilePath -> Ref -> IO Object looseReadHeader :: FilePath -> Ref -> IO (ObjectType, Word64, Maybe a) looseReadRaw :: FilePath -> Ref -> IO (ObjectHeader, ObjectData) looseExists :: FilePath -> Ref -> IO Bool looseWriteBlobFromFile :: FilePath -> FilePath -> IO () looseWrite :: FilePath -> Object -> IO () looseEnumeratePrefixes :: FilePath -> IO [[Char]] -- | read a specific ref from a loose object and returns an header and -- data. -- -- read only the header of a loose object. -- -- read a specific ref from a loose object and returns an object -- -- check if a specific ref exists as loose object -- -- enumarate all prefixes available in the object store. -- -- enumerate all references available with a specific prefix. looseEnumerateWithPrefixFilter :: FilePath -> String -> (Ref -> Bool) -> IO [Ref] looseEnumerateWithPrefix :: FilePath -> String -> IO [Ref] module Data.Git.Named headList :: FilePath -> IO [[Char]] headExists :: FilePath -> FilePath -> IO Bool headRead :: FilePath -> FilePath -> IO Ref headWrite :: FilePath -> FilePath -> Ref -> IO () remotesList :: FilePath -> IO [[Char]] remoteList :: FilePath -> FilePath -> IO [[Char]] tagList :: FilePath -> IO [[Char]] tagExists :: FilePath -> FilePath -> IO Bool tagRead :: FilePath -> FilePath -> IO Ref tagWrite :: FilePath -> FilePath -> Ref -> IO () specialRead :: [Char] -> FilePath -> IO Ref specialExists :: FilePath -> FilePath -> IO Bool module Data.Git.Pack data PackedObjectInfo PackedObjectInfo :: ObjectType -> Word64 -> Word64 -> Word64 -> Maybe ObjectPtr -> PackedObjectInfo poiType :: PackedObjectInfo -> ObjectType poiOffset :: PackedObjectInfo -> Word64 poiSize :: PackedObjectInfo -> Word64 poiActualSize :: PackedObjectInfo -> Word64 poiExtra :: PackedObjectInfo -> Maybe ObjectPtr type PackedObjectRaw = (PackedObjectInfo, ByteString) packEnumerate :: FilePath -> IO [Ref] -- | Enumerate the pack refs available in this repository. -- -- open a pack packOpen :: FilePath -> Ref -> IO FileReader -- | close a pack packClose :: FileReader -> IO () packReadHeader :: FilePath -> Ref -> IO Word32 packReadMapAtOffset :: FileReader -> Word64 -> (ByteString -> ByteString) -> IO (Maybe Object) -- | return the number of entries in this pack -- -- read an object at a specific position using a map function on the -- objectData -- -- read an object at a specific position packReadAtOffset :: FileReader -> Word64 -> IO (Maybe Object) -- | read a raw representation at a specific position packReadRawAtOffset :: FileReader -> Word64 -> IO (PackedObjectRaw) packEnumerateObjects :: FilePath -> Ref -> Int -> (PackedObjectRaw -> IO a) -> IO () packedObjectToObject :: (PackedObjectInfo, ByteString) -> Maybe Object packObjectFromRaw :: (ObjectType, Maybe ObjectPtr, ByteString) -> Maybe Object instance Show PackedObjectInfo instance Eq PackedObjectInfo module Data.Git.Index -- | represent an index header with the version and the fanout table data IndexHeader IndexHeader :: !Word32 -> !Vector Word32 -> IndexHeader data Index Index :: Vector Ref -> Vector Word32 -> Vector Word32 -> Ref -> Ref -> Index indexSha1s :: Index -> Vector Ref indexCRCs :: Index -> Vector Word32 indexPackoffs :: Index -> Vector Word32 indexPackChecksum :: Index -> Ref indexChecksum :: Index -> Ref -- | enumerate every indexes file in the pack directory -- -- open an index indexOpen :: FilePath -> Ref -> IO FileReader -- | close an index indexClose :: FileReader -> IO () withIndex :: FilePath -> Ref -> (FileReader -> IO a) -> IO a indexEnumerate :: FilePath -> IO [Ref] -- | get the number of reference in this index with a specific prefix indexHeaderGetNbWithPrefix :: IndexHeader -> Int -> Word32 -- | return the reference offset in the packfile if found indexGetReferenceLocation :: IndexHeader -> FileReader -> Ref -> IO (Maybe Word64) -- | get all references that start by prefix. indexGetReferencesWithPrefix :: IndexHeader -> FileReader -> String -> IO [Ref] -- | returns absolute offset in the index file of the sha1s, the crcs and -- the packfiles offset. -- -- parse index header -- -- read index header from an index filereader indexReadHeader :: FileReader -> IO IndexHeader indexRead :: FilePath -> Ref -> IO (IndexHeader, (Vector Ref, Vector Word32, Vector Word32, [ByteString], Ref, Ref)) -- | get index header from an index reference indexGetHeader :: FilePath -> Ref -> IO IndexHeader instance Show IndexHeader instance Eq IndexHeader module Data.Git.Repository -- | represent an git repo, with possibly already opened filereaders for -- indexes and packs data Git type HTree = [(Int, ByteString, HTreeEnt)] -- | hierarchy tree, either a reference to a blob (file) or a tree -- (directory). data HTreeEnt TreeDir :: Ref -> HTree -> HTreeEnt TreeFile :: Ref -> HTreeEnt gitRepoPath :: Git -> FilePath -- | open a new git repository context openRepo :: FilePath -> IO Git -- | close a git repository context, closing all remaining fileReaders. closeRepo :: Git -> IO () withRepo :: FilePath -> (Git -> IO c) -> IO c -- | find the git repository from the current directory. findRepo :: IO FilePath -- | execute a function f with a git context. findReference :: Git -> Ref -> IO ObjectLocation -- | get all the references that start by a specific prefix findReferencesWithPrefix :: Git -> String -> IO [Ref] -- | get an object from repository findObjectRaw :: Git -> Ref -> Bool -> IO (Maybe ObjectInfo) -- | get an object from repository findObjectRawAt :: Git -> ObjectLocation -> Bool -> IO (Maybe ObjectInfo) -- | get an object from repository using a ref. findObject :: Git -> Ref -> Bool -> IO (Maybe Object) findCommit :: Git -> Ref -> IO (Maybe Commit) findTree :: Git -> Ref -> IO (Maybe Tree) -- | get an object from repository using a location to reference it. findObjectAt :: Git -> ObjectLocation -> Bool -> IO (Maybe Object) -- | build a hierarchy tree from a tree object buildHTree :: Git -> Tree -> IO HTree -- | resolve the ref (tree or blob) related to a path at a specific commit -- ref resolvePath :: Git -> Ref -> [ByteString] -> IO (Maybe Ref) -- | returns a tree from a ref that might be either a commit, a tree or a -- tag. resolveTreeish :: Git -> Ref -> IO (Maybe Tree) -- | try to resolve a string to a specific commit ref for example: HEAD, -- HEAD^, master~3, shortRef resolveRevision :: Git -> Revision -> IO (Maybe Ref) -- | initialize a new repository at a specific location. initRepo :: FilePath -> IO () -- | basic checks to see if a specific path looks like a git repo. isRepo :: FilePath -> IO Bool