···2233// ExtraHeader represents an extra header in a Git object.
44type ExtraHeader struct {
55- Key string
55+ // Key represents the header key.
66+ Key string
77+ // Value represents the header value.
68 Value []byte
79}
+8-3
ident.go
···12121313// Ident represents a Git identity (author/committer/tagger).
1414type Ident struct {
1515- Name []byte
1616- Email []byte
1717- WhenUnix int64
1515+ // Name represents the person's name.
1616+ Name []byte
1717+ // Email represents the person's email.
1818+ Email []byte
1919+ // WhenUnix represents the timestamp as a Unix time.
2020+ // This value is in UTC.
2121+ WhenUnix int64
2222+ // The timezone offset in minutes.
1823 OffsetMinutes int32
1924}
2025
+2
obj.go
···38383939// Object represents a Git object.
4040type Object interface {
4141+ // ObjectType returns the object's type.
4142 ObjectType() ObjectType
4243}
4344···4546// one read from storage.
4647type StoredObject interface {
4748 Object
4949+ // Hash returns the object's hash.
4850 Hash() Hash
4951}
5052
+13-5
obj_commit.go
···8899// Commit represents a Git commit object.
1010type Commit struct {
1111- Tree Hash
1212- Parents []Hash
1313- Author Ident
1414- Committer Ident
1515- Message []byte
1111+ // Tree represents the tree hash referenced by the commit.
1212+ Tree Hash
1313+ // Parents represents the parent commit hashes.
1414+ // Commits that have 0 parents are root commits.
1515+ // Commits that have >= 2 parents are merge commits.
1616+ Parents []Hash
1717+ // Author represents the author of the commit.
1818+ Author Ident
1919+ // Committer represents the committer of the commit.
2020+ Committer Ident
2121+ // Message represents the commit message.
2222+ Message []byte
2323+ // ExtraHeaders holds any extra headers present in the commit.
1624 ExtraHeaders []ExtraHeader
1725}
1826
+11-4
obj_tag.go
···8899// Tag represents a Git annotated tag object.
1010type Tag struct {
1111- Target Hash
1111+ // Target represents the hash of the object being tagged.
1212+ Target Hash
1313+ // TargetType represents the type of the object being tagged.
1214 TargetType ObjectType
1313- Name []byte
1414- Tagger *Ident
1515- Message []byte
1515+ // Name represents the name of the tag.
1616+ Name []byte
1717+ // Tagger represents the identity of the tagger.
1818+ Tagger *Ident
1919+ // Message represents the tag message.
2020+ Message []byte
1621}
2222+2323+// TODO: ExtraHeaders and signatures
17241825// StoredTag represents a tag stored in the object database.
1926type StoredTag struct {
+6-1
obj_tree.go
···991010// Tree represents a Git tree object.
1111type Tree struct {
1212+ // Entries represents the entries in the tree.
1213 Entries []TreeEntry
1314}
1415···41424243// TreeEntry represents a single entry in a Git tree.
4344type TreeEntry struct {
4545+ // Mode represents the file mode of the entry.
4446 Mode FileMode
4747+ // Name represents the name of the entry.
4548 Name []byte
4646- ID Hash
4949+ // ID represents the hash of the entry. This is typically
5050+ // either a blob or a tree.
5151+ ID Hash
4752}
48534954// ObjectType returns the object type of the tree.