diff options
author | Joshua Sjoding <joshua.sjoding@scjalliance.com> | 2016-02-26 13:56:39 -0800 |
---|---|---|
committer | Joshua Sjoding <joshua.sjoding@scjalliance.com> | 2016-02-26 13:56:39 -0800 |
commit | ff809118743100300c38d0c626ffe8c840fb1275 (patch) | |
tree | d4e453951eff5b08863659de332047251f133972 /core | |
parent | 1e74b17f05ad27818df39818a0d22107a0b4b424 (diff) | |
download | go-git-ff809118743100300c38d0c626ffe8c840fb1275.tar.gz |
Added function to check validity of core.ObjectType
Diffstat (limited to 'core')
-rw-r--r-- | core/object.go | 5 |
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) { |