aboutsummaryrefslogtreecommitdiff
path: root/object/type/objecttype.go
blob: d803cadf39be44aea0c2459d1e90a98687bbec92 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Package objecttype provides Git object type tags and names.
package objecttype

// Type mirrors Git object type tags in packfiles.
type Type uint8

const (
	TypeInvalid  Type = 0
	TypeCommit   Type = 1
	TypeTree     Type = 2
	TypeBlob     Type = 3
	TypeTag      Type = 4
	TypeFuture   Type = 5
	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
	}
}