diff options
| author | 2026-03-29 11:05:46 +0000 | |
|---|---|---|
| committer | 2026-03-29 11:05:46 +0000 | |
| commit | 0109f0903d8e18d110d6b9456f9a1fb4501e62fc (patch) | |
| tree | f1b95c7c64d79fa0dab0251661600a299d8aefcb /object/type/objecttype.go | |
| parent | object{,/type}: Fix up API shape (diff) | |
| signature | No signature | |
object/type, format/packfile: API cleanups
Diffstat (limited to 'object/type/objecttype.go')
| -rw-r--r-- | object/type/objecttype.go | 13 |
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 + } +} |
