Fast implementation of Git in pure Go

Add a little bit more of documentation

+43 -14
+3 -1
headers.go
··· 2 2 3 3 // ExtraHeader represents an extra header in a Git object. 4 4 type ExtraHeader struct { 5 - Key string 5 + // Key represents the header key. 6 + Key string 7 + // Value represents the header value. 6 8 Value []byte 7 9 }
+8 -3
ident.go
··· 12 12 13 13 // Ident represents a Git identity (author/committer/tagger). 14 14 type Ident struct { 15 - Name []byte 16 - Email []byte 17 - WhenUnix int64 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. 18 23 OffsetMinutes int32 19 24 } 20 25
+2
obj.go
··· 38 38 39 39 // Object represents a Git object. 40 40 type Object interface { 41 + // ObjectType returns the object's type. 41 42 ObjectType() ObjectType 42 43 } 43 44 ··· 45 46 // one read from storage. 46 47 type StoredObject interface { 47 48 Object 49 + // Hash returns the object's hash. 48 50 Hash() Hash 49 51 } 50 52
+13 -5
obj_commit.go
··· 8 8 9 9 // Commit represents a Git commit object. 10 10 type Commit struct { 11 - Tree Hash 12 - Parents []Hash 13 - Author Ident 14 - Committer Ident 15 - Message []byte 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. 16 24 ExtraHeaders []ExtraHeader 17 25 } 18 26
+11 -4
obj_tag.go
··· 8 8 9 9 // Tag represents a Git annotated tag object. 10 10 type Tag struct { 11 - Target Hash 11 + // Target represents the hash of the object being tagged. 12 + Target Hash 13 + // TargetType represents the type of the object being tagged. 12 14 TargetType ObjectType 13 - Name []byte 14 - Tagger *Ident 15 - Message []byte 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 16 21 } 22 + 23 + // TODO: ExtraHeaders and signatures 17 24 18 25 // StoredTag represents a tag stored in the object database. 19 26 type StoredTag struct {
+6 -1
obj_tree.go
··· 9 9 10 10 // Tree represents a Git tree object. 11 11 type Tree struct { 12 + // Entries represents the entries in the tree. 12 13 Entries []TreeEntry 13 14 } 14 15 ··· 41 42 42 43 // TreeEntry represents a single entry in a Git tree. 43 44 type TreeEntry struct { 45 + // Mode represents the file mode of the entry. 44 46 Mode FileMode 47 + // Name represents the name of the entry. 45 48 Name []byte 46 - ID Hash 49 + // ID represents the hash of the entry. This is typically 50 + // either a blob or a tree. 51 + ID Hash 47 52 } 48 53 49 54 // ObjectType returns the object type of the tree.