aboutsummaryrefslogtreecommitdiff
path: root/object/signed/commit/commit.go
diff options
context:
space:
mode:
Diffstat (limited to 'object/signed/commit/commit.go')
-rw-r--r--object/signed/commit/commit.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/object/signed/commit/commit.go b/object/signed/commit/commit.go
new file mode 100644
index 00000000..f3e0a021
--- /dev/null
+++ b/object/signed/commit/commit.go
@@ -0,0 +1,30 @@
+package commit
+
+import "lindenii.org/go/furgit/object/id"
+
+// Commit represents the payload and signatures
+// parsed from a raw commit object.
+type Commit struct {
+ body []byte
+ payload []byteRange
+ signatures map[id.ObjectFormat][]byteRange
+}
+
+// ObjectFormats returns the object formats
+// for which the commit carries signatures.
+func (commit *Commit) ObjectFormats() []id.ObjectFormat {
+ var objectFormats []id.ObjectFormat
+
+ for _, objectFormat := range id.SupportedObjectFormats() {
+ if _, ok := commit.signatures[objectFormat]; ok {
+ objectFormats = append(objectFormats, objectFormat)
+ }
+ }
+
+ return objectFormats
+}
+
+type byteRange struct {
+ start int
+ end int
+}