aboutsummaryrefslogtreecommitdiff
path: root/Git/Types.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-06-06 02:31:31 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-06-06 02:31:31 -0400
commitf596084a599fb363dcbb425dce7c4ca46bb56ca0 (patch)
tree934e14858c9f56cf9f69cb7eadfadee4a8b4c1eb /Git/Types.hs
parentf1bd72ea546be705334ba8f6d01d9dcfb0c33cf9 (diff)
move hashObject to HashObject library and generalize it to support all git object types
Diffstat (limited to 'Git/Types.hs')
-rw-r--r--Git/Types.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/Git/Types.hs b/Git/Types.hs
index deb14ebd4..64d418a04 100644
--- a/Git/Types.hs
+++ b/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
+