diff options
| author | 2025-11-16 00:00:00 +0000 | |
|---|---|---|
| committer | 2025-11-16 00:00:00 +0000 | |
| commit | 503f2f1bbc69be553d04c621c7ec33931cc1f57d (patch) | |
| tree | 289b2ea2dc589d6ce7efc3e44966eabb6739d3f2 | |
| parent | README: benmarking -> test (diff) | |
| signature | ||
Add a little bit more of documentation
| -rw-r--r-- | headers.go | 4 | ||||
| -rw-r--r-- | ident.go | 11 | ||||
| -rw-r--r-- | obj.go | 2 | ||||
| -rw-r--r-- | obj_commit.go | 18 | ||||
| -rw-r--r-- | obj_tag.go | 15 | ||||
| -rw-r--r-- | obj_tree.go | 7 |
6 files changed, 43 insertions, 14 deletions
@@ -2,6 +2,8 @@ package furgit // ExtraHeader represents an extra header in a Git object. type ExtraHeader struct { - Key string + // Key represents the header key. + Key string + // Value represents the header value. Value []byte } @@ -12,9 +12,14 @@ import ( // Ident represents a Git identity (author/committer/tagger). type Ident struct { - Name []byte - Email []byte - WhenUnix int64 + // Name represents the person's name. + Name []byte + // Email represents the person's email. + Email []byte + // WhenUnix represents the timestamp as a Unix time. + // This value is in UTC. + WhenUnix int64 + // The timezone offset in minutes. OffsetMinutes int32 } @@ -38,6 +38,7 @@ const ( // Object represents a Git object. type Object interface { + // ObjectType returns the object's type. ObjectType() ObjectType } @@ -45,6 +46,7 @@ type Object interface { // one read from storage. type StoredObject interface { Object + // Hash returns the object's hash. Hash() Hash } diff --git a/obj_commit.go b/obj_commit.go index 9953f690..524ef7bd 100644 --- a/obj_commit.go +++ b/obj_commit.go @@ -8,11 +8,19 @@ import ( // Commit represents a Git commit object. type Commit struct { - Tree Hash - Parents []Hash - Author Ident - Committer Ident - Message []byte + // Tree represents the tree hash referenced by the commit. + Tree Hash + // Parents represents the parent commit hashes. + // Commits that have 0 parents are root commits. + // Commits that have >= 2 parents are merge commits. + Parents []Hash + // Author represents the author of the commit. + Author Ident + // Committer represents the committer of the commit. + Committer Ident + // Message represents the commit message. + Message []byte + // ExtraHeaders holds any extra headers present in the commit. ExtraHeaders []ExtraHeader } @@ -8,13 +8,20 @@ import ( // Tag represents a Git annotated tag object. type Tag struct { - Target Hash + // Target represents the hash of the object being tagged. + Target Hash + // TargetType represents the type of the object being tagged. TargetType ObjectType - Name []byte - Tagger *Ident - Message []byte + // Name represents the name of the tag. + Name []byte + // Tagger represents the identity of the tagger. + Tagger *Ident + // Message represents the tag message. + Message []byte } +// TODO: ExtraHeaders and signatures + // StoredTag represents a tag stored in the object database. type StoredTag struct { Tag diff --git a/obj_tree.go b/obj_tree.go index be4accb5..689b3690 100644 --- a/obj_tree.go +++ b/obj_tree.go @@ -9,6 +9,7 @@ import ( // Tree represents a Git tree object. type Tree struct { + // Entries represents the entries in the tree. Entries []TreeEntry } @@ -41,9 +42,13 @@ const ( // TreeEntry represents a single entry in a Git tree. type TreeEntry struct { + // Mode represents the file mode of the entry. Mode FileMode + // Name represents the name of the entry. Name []byte - ID Hash + // ID represents the hash of the entry. This is typically + // either a blob or a tree. + ID Hash } // ObjectType returns the object type of the tree. |
