Oid type represents a Git hash value, whether partial or full. In
general users do not interact with this type much, as all the top-level
functions which expect hash values typically expect strings.
- data Oid
- newtype COid = COid (ForeignPtr C'git_oid)
- oidToStr :: Ptr C'git_oid -> IO String
- data ObjRef a
- data Ident a
- wrapOidPtr :: Ptr C'git_oid -> IO (ObjRef a)
- compareCOid :: COid -> COid -> Ordering
- compareCOidLen :: COid -> COid -> Int -> Ordering
- equalCOid :: Ord a => a -> a -> Bool
- stringToOid :: CStringable a => a -> IO (Maybe Oid)
Oid represents either a full or partial SHA1 hash code used to identify
COid is a type wrapper for a foreign pointer to libgit2's
structure. Users should not have to deal with this type.
ObjRef refers to either a Git object of a particular type (if it has
already been loaded into memory), or it refers to the
COid of that
object in the repository. This permits deferred loading of objects
within potentially very large structures, such as trees and commits.
However, it also means that every access to a sub-object must use
loadObject from the type class
Ident abstracts the fact that some objects won't have an identifier
until they are written to disk -- even if sufficient information exists
to determine that hash value. If construct as a
Pending value, it is
IO action that writes the object to disk and retrieves the resulting
hash value from Git; if
Stored, it is a
COid that is known to the
COid values for equality, but only up to a certain length.
stringToOid "a143ecf"Just a143ecf
stringToOid "a143ecf" >>= (\(Just (PartialOid _ l)) -> return $ l == 7)True
let hash = "6cfc2ca31732fb6fa6b54bae6e586a57a0611aab"
stringToOid hashJust 6cfc2ca31732fb6fa6b54bae6e586a57a0611aab
stringToOid hash >>= (\(Just (Oid _)) -> return True)True