···23// ExtraHeader represents an extra header in a Git object.
4type ExtraHeader struct {
5- Key string
006 Value []byte
7}
···23// ExtraHeader represents an extra header in a Git object.
4type ExtraHeader struct {
5+ // Key represents the header key.
6+ Key string
7+ // Value represents the header value.
8 Value []byte
9}
···1213// Ident represents a Git identity (author/committer/tagger).
14type Ident struct {
15+ // Name represents the person's name.
16+ Name []byte
17+ // Email represents the person's email.
18+ Email []byte
19+ // WhenUnix represents the timestamp as a Unix time.
20+ // This value is in UTC.
21+ WhenUnix int64
22+ // The timezone offset in minutes.
23 OffsetMinutes int32
24}
25
+2
obj.go
···3839// Object represents a Git object.
40type Object interface {
041 ObjectType() ObjectType
42}
43···45// one read from storage.
46type StoredObject interface {
47 Object
048 Hash() Hash
49}
50
···3839// Object represents a Git object.
40type Object interface {
41+ // ObjectType returns the object's type.
42 ObjectType() ObjectType
43}
44···46// one read from storage.
47type StoredObject interface {
48 Object
49+ // Hash returns the object's hash.
50 Hash() Hash
51}
52
···89// Commit represents a Git commit object.
10type Commit struct {
11+ // Tree represents the tree hash referenced by the commit.
12+ Tree Hash
13+ // Parents represents the parent commit hashes.
14+ // Commits that have 0 parents are root commits.
15+ // Commits that have >= 2 parents are merge commits.
16+ Parents []Hash
17+ // Author represents the author of the commit.
18+ Author Ident
19+ // Committer represents the committer of the commit.
20+ Committer Ident
21+ // Message represents the commit message.
22+ Message []byte
23+ // ExtraHeaders holds any extra headers present in the commit.
24 ExtraHeaders []ExtraHeader
25}
26
+11-4
obj_tag.go
···89// Tag represents a Git annotated tag object.
10type Tag struct {
11- Target Hash
0012 TargetType ObjectType
13- Name []byte
14- Tagger *Ident
15- Message []byte
00016}
001718// StoredTag represents a tag stored in the object database.
19type StoredTag struct {
···89// Tag represents a Git annotated tag object.
10type Tag struct {
11+ // Target represents the hash of the object being tagged.
12+ Target Hash
13+ // TargetType represents the type of the object being tagged.
14 TargetType ObjectType
15+ // Name represents the name of the tag.
16+ Name []byte
17+ // Tagger represents the identity of the tagger.
18+ Tagger *Ident
19+ // Message represents the tag message.
20+ Message []byte
21}
22+23+// TODO: ExtraHeaders and signatures
2425// StoredTag represents a tag stored in the object database.
26type StoredTag struct {
+6-1
obj_tree.go
···910// Tree represents a Git tree object.
11type Tree struct {
012 Entries []TreeEntry
13}
14···4142// TreeEntry represents a single entry in a Git tree.
43type TreeEntry struct {
044 Mode FileMode
045 Name []byte
46- ID Hash
0047}
4849// ObjectType returns the object type of the tree.
···910// Tree represents a Git tree object.
11type Tree struct {
12+ // Entries represents the entries in the tree.
13 Entries []TreeEntry
14}
15···4243// TreeEntry represents a single entry in a Git tree.
44type TreeEntry struct {
45+ // Mode represents the file mode of the entry.
46 Mode FileMode
47+ // Name represents the name of the entry.
48 Name []byte
49+ // ID represents the hash of the entry. This is typically
50+ // either a blob or a tree.
51+ ID Hash
52}
5354// ObjectType returns the object type of the tree.