Data.Git.Ref

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

Contents

- Exceptions
- convert from bytestring and string
- Misc function related to ref
- Hash ByteString types to a ref

Description

Synopsis

- data Ref
- data RefInvalid = RefInvalid ByteString
- data RefNotFound = RefNotFound Ref
- isHex :: ByteString -> Bool
- isHexString :: [Char] -> Bool
- fromHex :: ByteString -> Ref
- fromHexString :: String -> Ref
- fromBinary :: ByteString -> Ref
- toBinary :: Ref -> ByteString
- toHex :: Ref -> ByteString
- toHexString :: Ref -> String
- refPrefix :: Ref -> Int
- cmpPrefix :: String -> Ref -> Ordering
- toFilePathParts :: Ref -> (String, String)
- hash :: ByteString -> Ref
- hashLBS :: ByteString -> Ref

# Documentation

data Ref #

represent a git reference (SHA1)

Instances

Eq Ref # |
Methods (==) :: Ref -> Ref -> Bool # (/=) :: Ref -> Ref -> Bool #
Data Ref # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Ref -> c Ref # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Ref # toConstr :: Ref -> Constr # dataTypeOf :: Ref -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Ref) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Ref) # gmapT :: (forall b. Data b => b -> b) -> Ref -> Ref # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Ref -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Ref -> r # gmapQ :: (forall d. Data d => d -> u) -> Ref -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Ref -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Ref -> m Ref # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Ref -> m Ref # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Ref -> m Ref #
Ord Ref # |
Methods compare :: Ref -> Ref -> Ordering # (<) :: Ref -> Ref -> Bool # (<=) :: Ref -> Ref -> Bool # (>) :: Ref -> Ref -> Bool # (>=) :: Ref -> Ref -> Bool # max :: Ref -> Ref -> Ref # min :: Ref -> Ref -> Ref #
Show Ref # |
Methods showsPrec :: Int -> Ref -> ShowS # show :: Ref -> String # showList :: [Ref] -> ShowS #

# Exceptions

data RefInvalid #

Invalid Reference exception raised when using something that is not a ref as a ref.

Constructors

RefInvalid ByteString |

Instances

Eq RefInvalid # |
Methods (==) :: RefInvalid -> RefInvalid -> Bool # (/=) :: RefInvalid -> RefInvalid -> Bool #
Data RefInvalid # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> RefInvalid -> c RefInvalid # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c RefInvalid # toConstr :: RefInvalid -> Constr # dataTypeOf :: RefInvalid -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c RefInvalid) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RefInvalid) # gmapT :: (forall b. Data b => b -> b) -> RefInvalid -> RefInvalid # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RefInvalid -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RefInvalid -> r # gmapQ :: (forall d. Data d => d -> u) -> RefInvalid -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> RefInvalid -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> RefInvalid -> m RefInvalid # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> RefInvalid -> m RefInvalid # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> RefInvalid -> m RefInvalid #
Show RefInvalid # |
Methods showsPrec :: Int -> RefInvalid -> ShowS # show :: RefInvalid -> String # showList :: [RefInvalid] -> ShowS #
Exception RefInvalid # |
Methods toException :: RefInvalid -> SomeException # fromException :: SomeException -> Maybe RefInvalid # displayException :: RefInvalid -> String #

data RefNotFound #

Reference wasn't found

Constructors

RefNotFound Ref |

Instances

Eq RefNotFound # |
Methods (==) :: RefNotFound -> RefNotFound -> Bool # (/=) :: RefNotFound -> RefNotFound -> Bool #
Data RefNotFound # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> RefNotFound -> c RefNotFound # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c RefNotFound # toConstr :: RefNotFound -> Constr # dataTypeOf :: RefNotFound -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c RefNotFound) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RefNotFound) # gmapT :: (forall b. Data b => b -> b) -> RefNotFound -> RefNotFound # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RefNotFound -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RefNotFound -> r # gmapQ :: (forall d. Data d => d -> u) -> RefNotFound -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> RefNotFound -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> RefNotFound -> m RefNotFound # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> RefNotFound -> m RefNotFound # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> RefNotFound -> m RefNotFound #
Show RefNotFound # |
Methods showsPrec :: Int -> RefNotFound -> ShowS # show :: RefNotFound -> String # showList :: [RefNotFound] -> ShowS #
Exception RefNotFound # |
Methods toException :: RefNotFound -> SomeException # fromException :: SomeException -> Maybe RefNotFound # displayException :: RefNotFound -> String #

# convert from bytestring and string

isHex :: ByteString -> Bool #

isHexString :: [Char] -> Bool #

fromHex :: ByteString -> Ref #

take a hexadecimal bytestring that represent a reference and turn into a ref

fromHexString :: String -> Ref #

take a hexadecimal string that represent a reference and turn into a ref

fromBinary :: ByteString -> Ref #

transform a bytestring that represent a binary bytestring and returns a ref.

toBinary :: Ref -> ByteString #

turn a reference into a binary bytestring

toHex :: Ref -> ByteString #

transform a ref into an hexadecimal bytestring

toHexString :: Ref -> String #

transform a ref into an hexadecimal string

# Misc function related to ref

refPrefix :: Ref -> Int #

returns the prefix (leading byte) of this reference

cmpPrefix :: String -> Ref -> Ordering #

compare prefix

toFilePathParts :: Ref -> (String, String) #

returns the splitted format "prefix/suffix" for addressing the loose object database

# Hash ByteString types to a ref

hash :: ByteString -> Ref #

hash a bytestring into a reference

hashLBS :: ByteString -> Ref #

hash a lazy bytestring into a reference