aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/object.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/object.go b/core/object.go
index d56a44a..7cc8af9 100644
--- a/core/object.go
+++ b/core/object.go
@@ -79,6 +79,11 @@ func (t ObjectType) Bytes() []byte {
return []byte(t.String())
}
+// Valid returns true if t is a valid ObjectType.
+func (t ObjectType) Valid() bool {
+ return t >= CommitObject && t <= REFDeltaObject
+}
+
// ParseObjectType parses a string representation of ObjectType. It returns an
// error on parse failure.
func ParseObjectType(value string) (typ ObjectType, err error) {