aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object.go
diff options
context:
space:
mode:
authorSantiago M. Mola <santi@mola.io>2017-07-27 17:24:01 +0200
committerSantiago M. Mola <santi@mola.io>2017-07-27 17:24:01 +0200
commit16b24f84e9342234ad90da27a6532887b05d1965 (patch)
tree5e75e59f89b87988fd18e0258d32314e69a87292 /plumbing/object.go
parent87413ced43b02a41359ce7a1a07ab41aec6ee313 (diff)
downloadgo-git-16b24f84e9342234ad90da27a6532887b05d1965.tar.gz
plumbing: add IsDelta method to ObjectType
ObjectType.IsDelta is a convenience function to match both offset and reference delta types.
Diffstat (limited to 'plumbing/object.go')
-rw-r--r--plumbing/object.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/plumbing/object.go b/plumbing/object.go
index 63396f0..2655dee 100644
--- a/plumbing/object.go
+++ b/plumbing/object.go
@@ -82,6 +82,12 @@ func (t ObjectType) Valid() bool {
return t >= CommitObject && t <= REFDeltaObject
}
+// IsDelta returns true for any ObjectTyoe that represents a delta (i.e.
+// REFDeltaObject or OFSDeltaObject).
+func (t ObjectType) IsDelta() bool {
+ return t == REFDeltaObject || t == OFSDeltaObject
+}
+
// ParseObjectType parses a string representation of ObjectType. It returns an
// error on parse failure.
func ParseObjectType(value string) (typ ObjectType, err error) {