From ff809118743100300c38d0c626ffe8c840fb1275 Mon Sep 17 00:00:00 2001 From: Joshua Sjoding Date: Fri, 26 Feb 2016 13:56:39 -0800 Subject: Added function to check validity of core.ObjectType --- core/object.go | 5 +++++ 1 file changed, 5 insertions(+) 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) { -- cgit