move hashObject to HashObject library and generalize it to support all git object types
This commit is contained in:
parent
f1bd72ea54
commit
f596084a59
4 changed files with 36 additions and 22 deletions
15
Git/Types.hs
15
Git/Types.hs
|
@ -48,3 +48,18 @@ instance Show Ref where
|
|||
type Branch = Ref
|
||||
type Sha = Ref
|
||||
type Tag = Ref
|
||||
|
||||
{- Types of objects that can be stored in git. -}
|
||||
data ObjectType = BlobObject | CommitObject | TreeObject
|
||||
|
||||
instance Show ObjectType where
|
||||
show BlobObject = "blob"
|
||||
show CommitObject = "commit"
|
||||
show TreeObject = "tree"
|
||||
|
||||
readObjectType :: String -> Maybe ObjectType
|
||||
readObjectType "blob" = Just BlobObject
|
||||
readObjectType "commit" = Just CommitObject
|
||||
readObjectType "tree" = Just TreeObject
|
||||
readObjectType _ = Nothing
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue