Portability | unix |
---|---|
Stability | experimental |
Maintainer | Vincent Hanquez <vincent@snarc.org> |
Safe Haskell | None |
- data Ref
- newtype RefName = RefName {
- refNameRaw :: String
- data Commit = Commit {}
- data Person = Person {}
- data CommitExtra = CommitExtra {}
- data Tree = Tree {
- treeGetEnts :: [TreeEnt]
- data Blob = Blob {}
- data Tag = Tag {
- tagRef :: Ref
- tagObjectType :: ObjectType
- tagBlob :: ByteString
- tagName :: Person
- tagS :: ByteString
- data GitTime
- newtype ModePerm = ModePerm Word32
- data ObjectFileType
- data FilePermissions = FilePermissions {
- getOwnerPerm :: !Perm
- getGroupPerm :: !Perm
- getOtherPerm :: !Perm
- getPermission :: ModePerm -> FilePermissions
- getFiletype :: ModePerm -> ObjectFileType
- data Revision
- resolveRevision :: Git -> Revision -> IO (Maybe Ref)
- resolveTreeish :: Git -> Ref -> IO (Maybe Tree)
- resolvePath :: Git -> Ref -> [ByteString] -> IO (Maybe Ref)
- data Git
- withCurrentRepo :: (Git -> IO a) -> IO a
- withRepo :: FilePath -> (Git -> IO c) -> IO c
- findRepo :: IO FilePath
- initRepo :: FilePath -> IO ()
- isRepo :: FilePath -> IO Bool
- rewrite :: Git -> (Commit -> IO Commit) -> Revision -> Int -> IO Ref
- getObject :: Git -> Ref -> Bool -> IO (Maybe Object)
- getCommit :: Git -> Ref -> IO Commit
- getTree :: Git -> Ref -> IO Tree
- setObject :: Git -> Object -> IO Ref
- toObject :: Objectable a => a -> Object
- branchWrite :: Git -> RefName -> Ref -> IO ()
- branchList :: Git -> IO (Set RefName)
- tagWrite :: Git -> RefName -> Ref -> IO ()
- tagList :: Git -> IO (Set RefName)
- headSet :: Git -> Either Ref RefName -> IO ()
- headGet :: Git -> IO (Either Ref RefName)
Basic types
Represent a commit object.
Commit | |
|
an author or committer line has the format: name email time timezone FIXME: should be a string, but I don't know if the data is stored consistantly in one encoding (UTF8)
data CommitExtra Source
Represent a root tree with zero to many tree entries.
Tree | |
|
Represent a binary blob.
Represent a signed tag.
Tag | |
|
Git time is number of seconds since unix epoch in the UTC zone with the current timezone associated
Helper & type related to ModePerm
data ObjectFileType Source
Git object file type
data FilePermissions Source
traditional unix permission for owner, group and permissions
FilePermissions | |
|
Revision
A git revision. this can be many things:
* a shorten ref
* a ref
* a named branch or tag
followed by optional modifiers RevModifier
that can represent:
* parenting
* type
* date
resolveRevision :: Git -> Revision -> IO (Maybe Ref)Source
try to resolve a string to a specific commit ref for example: HEAD, HEAD^, master~3, shortRef
Object resolution
resolveTreeish :: Git -> Ref -> IO (Maybe Tree)Source
returns a tree from a ref that might be either a commit, a tree or a tag.
resolve the ref (tree or blob) related to a path at a specific commit ref
repo context
withCurrentRepo :: (Git -> IO a) -> IO aSource
execute a function on the current repository.
check findRepo to see how the git repository is found.
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
Repository queries and creation
Context operations
:: Git | Repository |
-> (Commit -> IO Commit) | Mapping function |
-> Revision | revision to start from |
-> Int | the number of parents to map |
-> IO Ref | return the new head REF |
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 <-- b <-- c <-- d
result in the following tree after mapping with f:
a <-- f(b) <-- f(c) <-- f(d)
Get objects
:: Git | repository |
-> Ref | the object's reference to |
-> Bool | whether to resolve deltas if found |
-> IO (Maybe Object) | returned object if found |
get an object from repository using a ref.
getCommit :: Git -> Ref -> IO CommitSource
get a specified commit but raises an exception if doesn't exists or type is not appropriate
Set objects
setObject :: Git -> Object -> IO RefSource
set an object in the store and returns the new ref this is always going to create a loose object.
toObject :: Objectable a => a -> ObjectSource
Named refs
Write a branch to point to a specific reference
Write a tag to point to a specific reference
Set head to point to either a reference or a branch name.