hit-0.6.3: Git operations in haskell

License | BSD-style
Maintainer | Vincent Hanquez <vincent@snarc.org>
Stability | experimental
Portability | unix
Safe Haskell | None
Language | Haskell98

Data.Git.Storage.Object

Contents

- parsing function
- writing function

Description

Synopsis

- data ObjectLocation
  - = NotFound
  - | Loose Ref
  - | Packed Ref Word64
- data ObjectType
  - = TypeTree
  - | TypeBlob
  - | TypeCommit
  - | TypeTag
  - | TypeDeltaOff
  - | TypeDeltaRef
- type ObjectHeader = (ObjectType, Word64, Maybe ObjectPtr)
- type ObjectData = ByteString
- data ObjectPtr
  - = PtrRef Ref
  - | PtrOfs Word64
- data Object
  - = ObjCommit Commit
  - | ObjTag Tag
  - | ObjBlob Blob
  - | ObjTree Tree
  - | ObjDeltaOfs DeltaOfs
  - | ObjDeltaRef DeltaRef
- data ObjectInfo = ObjectInfo {
  - oiHeader :: ObjectHeader
  - oiData :: ObjectData
  - oiChains :: [ObjectPtr]
  }
- class Objectable a where
  - getType :: a -> ObjectType
  - getRaw :: a -> ByteString
  - isDelta :: a -> Bool
  - toObject :: 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
- objectWriteHeader :: ObjectType -> Word64 -> ByteString
- objectWrite :: Object -> ByteString
- objectHash :: ObjectType -> Word64 -> ByteString -> Ref

# Documentation

data ObjectLocation Source

location of an object in the database

Constructors

NotFound |
Loose Ref |
Packed Ref Word64 |

Instances

Eq ObjectLocation Source |
Show ObjectLocation Source |

data ObjectType Source

type of a git object.

Constructors

TypeTree |
TypeBlob |
TypeCommit |
TypeTag |
TypeDeltaOff |
TypeDeltaRef |

Instances

Enum ObjectType Source | the enum instance is useful when marshalling to pack file.
Eq ObjectType Source |
Data ObjectType Source |
Show ObjectType Source |

type ObjectHeader = (ObjectType, Word64, Maybe ObjectPtr) Source

type ObjectData = ByteString Source

data ObjectPtr Source

Delta objects points to some others objects in the database either as offset in the pack or as a direct reference.

Constructors

PtrRef Ref |
PtrOfs Word64 |

Instances

Eq ObjectPtr Source |
Show ObjectPtr Source |

data Object Source

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.

Constructors

ObjCommit Commit |
ObjTag Tag |
ObjBlob Blob |
ObjTree Tree |
ObjDeltaOfs DeltaOfs |
ObjDeltaRef DeltaRef |

Instances

Eq Object Source |
Show Object Source |

data ObjectInfo Source

Raw objects infos have an header (type, size, ptr), the data and a pointers chains to parents for resolved objects.

Constructors

ObjectInfo |

Fields

oiHeader :: ObjectHeader
oiData :: ObjectData
oiChains :: [ObjectPtr]

Instances

Eq ObjectInfo Source |
Show ObjectInfo Source |

class Objectable a where Source

Methods

getType :: a -> ObjectType Source

getRaw :: a -> ByteString Source

isDelta :: a -> Bool Source

toObject :: a -> Object Source

Instances

Objectable DeltaRef Source |
Objectable DeltaOfs Source |
Objectable Tag Source |
Objectable Commit Source |
Objectable Blob Source |
Objectable Tree Source |

objectToType :: Object -> ObjectType Source

objectTypeMarshall :: ObjectType -> String Source

objectTypeUnmarshall :: String -> ObjectType Source

objectTypeIsDelta :: ObjectType -> Bool Source

objectIsDelta :: Object -> Bool Source

objectToTree :: Object -> Maybe Tree Source

objectToCommit :: Object -> Maybe Commit Source

objectToTag :: Object -> Maybe Tag Source

objectToBlob :: Object -> Maybe Blob Source

# parsing function

treeParse :: Parser ByteString Tree Source

parse a tree content

commitParse :: Parser ByteString Commit Source

parse a commit content

tagParse :: Parser ByteString Tag Source

parse a tag content

blobParse :: Parser ByteString Blob Source

parse a blob content

objectParseTree :: Parser ByteString Object Source

objectParseCommit :: Parser ByteString Object Source

objectParseTag :: Parser ByteString Object Source

objectParseBlob :: Parser ByteString Object Source

# writing function

objectWriteHeader :: ObjectType -> Word64 -> ByteString Source

objectWrite :: Object -> ByteString Source

objectHash :: ObjectType -> Word64 -> ByteString -> Ref Source