aboutsummaryrefslogtreecommitdiff
path: root/object/type/objecttype.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-29 11:05:46 +0000
committerGravatar Runxi Yu2026-03-29 11:05:46 +0000
commit0109f0903d8e18d110d6b9456f9a1fb4501e62fc (patch)
treef1b95c7c64d79fa0dab0251661600a299d8aefcb /object/type/objecttype.go
parentobject{,/type}: Fix up API shape (diff)
signatureNo signature
object/type, format/packfile: API cleanups
Diffstat (limited to 'object/type/objecttype.go')
-rw-r--r--object/type/objecttype.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/object/type/objecttype.go b/object/type/objecttype.go
index 18e0ac35..d803cadf 100644
--- a/object/type/objecttype.go
+++ b/object/type/objecttype.go
@@ -14,3 +14,16 @@ const (
TypeOfsDelta Type = 6
TypeRefDelta Type = 7
)
+
+// IsBaseObject reports whether ty is one of the four canonical Git object
+// types encoded directly in pack entries.
+func (ty Type) IsBaseObject() bool {
+ switch ty {
+ case TypeCommit, TypeTree, TypeBlob, TypeTag:
+ return true
+ case TypeInvalid, TypeFuture, TypeOfsDelta, TypeRefDelta:
+ return false
+ default:
+ return false
+ }
+}