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 -> (t -> (Ref, PackIndexReader) -> IO (t, Bool)) -> t -> IO t
- 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 #

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

packedNamed :: Git -> CachedPackedRef #

gitRepoPath :: Git -> FilePath #

configs :: Git -> IORef [Config] #

# opening repositories

openRepo :: FilePath -> IO Git #

open a new git repository context

closeRepo :: Git -> IO () #

close a git repository context, closing all remaining fileReaders.

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

execute a function f with a git context.

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

execute a function on the current repository.

check findRepo to see how the git repository is found.

findRepoMaybe :: IO (Maybe FilePath) #

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 #

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 #

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

# creating repositories

initRepo :: FilePath -> IO () #

initialize a new repository at a specific location.

# repository accessors

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

read the repository's description

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

set the repository's description

# iterators

iterateIndexes :: Git -> (t -> (Ref, PackIndexReader) -> IO (t, Bool)) -> t -> IO t #

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

Get the object location of a specific reference

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

get all the references that start by a specific prefix

# getting objects

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

get an object from repository

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

get an object from repository

getObject #

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_ #

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) #

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

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

get an object type from repository

# setting objects

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

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