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

Contents

- opening repositories
- creating repositories
- repository accessors
- iterators
- getting objects
- setting objects

Description

Synopsis

- data Git
- packedNamed :: Git -> CachedPackedRef
- gitRepoPath :: Git -> FilePath
- configs :: Git -> IORef [Config]
- openRepo :: FilePath -> IO Git
- closeRepo :: Git -> IO ()
- withRepo :: FilePath -> (Git -> IO c) -> IO c
- withCurrentRepo :: (Git -> IO a) -> IO a
- findRepoMaybe :: IO (Maybe FilePath)
- findRepo :: IO FilePath
- isRepo :: FilePath -> IO Bool
- initRepo :: FilePath -> IO ()
- getDescription :: Git -> IO (Maybe String)
- setDescription :: Git -> String -> IO ()
- iterateIndexes :: Git -> (b -> (Ref, PackIndexReader) -> IO (b, Bool)) -> b -> IO b
- findReference :: Git -> Ref -> IO ObjectLocation
- findReferencesWithPrefix :: Git -> String -> IO [Ref]
- getObjectRaw :: Git -> Ref -> Bool -> IO (Maybe ObjectInfo)
- getObjectRawAt :: Git -> ObjectLocation -> Bool -> IO (Maybe ObjectInfo)
- getObject :: Git -> Ref -> Bool -> IO (Maybe Object)
- getObject_ :: Git -> Ref -> Bool -> IO Object
- getObjectAt :: Git -> ObjectLocation -> Bool -> IO (Maybe Object)
- getObjectType :: Git -> Ref -> IO (Maybe ObjectType)
- setObject :: Git -> Object -> IO Ref

# Documentation

data Git Source

represent a git repo, with possibly already opened filereaders for indexes and packs

packedNamed :: Git -> CachedPackedRef Source

gitRepoPath :: Git -> FilePath Source

configs :: Git -> IORef [Config] Source

# opening repositories

openRepo :: FilePath -> IO Git Source

open a new git repository context

closeRepo :: Git -> IO () Source

close a git repository context, closing all remaining fileReaders.

withRepo :: FilePath -> (Git -> IO c) -> IO c Source

execute a function f with a git context.

withCurrentRepo :: (Git -> IO a) -> IO a Source

execute a function on the current repository.

check findRepo to see how the git repository is found.

findRepoMaybe :: IO (Maybe FilePath) Source

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 FilePath Source

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

isRepo :: FilePath -> IO Bool Source

basic checks to see if a specific path looks like a git repo.

# creating repositories

initRepo :: FilePath -> IO () Source

initialize a new repository at a specific location.

# repository accessors

getDescription :: Git -> IO (Maybe String) Source

read the repository's description

setDescription :: Git -> String -> IO () Source

set the repository's description

# iterators

iterateIndexes :: Git -> (b -> (Ref, PackIndexReader) -> IO (b, Bool)) -> b -> IO b Source

findReference :: Git -> Ref -> IO ObjectLocation Source

Get the object location of a specific reference

findReferencesWithPrefix :: Git -> String -> IO [Ref] Source

get all the references that start by a specific prefix

# getting objects

getObjectRaw :: Git -> Ref -> Bool -> IO (Maybe ObjectInfo) Source

get an object from repository

getObjectRawAt :: Git -> ObjectLocation -> Bool -> IO (Maybe ObjectInfo) Source

get an object from repository

getObject Source

Arguments

:: 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.

getObject_ Source

Arguments

:: Git | repository
-> Ref | the object's reference to
-> Bool | whether to resolve deltas if found
-> IO Object | returned object if found

Just like `getObject` but will raise a RefNotFound exception if the reference cannot be found.

getObjectAt :: Git -> ObjectLocation -> Bool -> IO (Maybe Object) Source

get an object from repository using a location to reference it.

getObjectType :: Git -> Ref -> IO (Maybe ObjectType) Source

get an object type from repository

# setting objects

setObject :: Git -> Object -> IO Ref Source

set an object in the store and returns the new ref this is always going to create a loose object.