aboutsummaryrefslogtreecommitdiff
path: root/obj_commit.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2025-11-16 00:00:00 +0000
committerGravatar Runxi Yu2025-11-16 00:00:00 +0000
commit43c25d457becb64ed2f76fbe2935475056a1081a (patch)
treed2cda5f0912ee3cd733aeda626096bd64115eabb /obj_commit.go
parentSeparate stored object types from types that the user is expected to construct. (diff)
signature
Documentation overhaul
Diffstat (limited to 'obj_commit.go')
-rw-r--r--obj_commit.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/obj_commit.go b/obj_commit.go
index c3a4e5db..9953f690 100644
--- a/obj_commit.go
+++ b/obj_commit.go
@@ -27,7 +27,9 @@ func (sCommit *StoredCommit) Hash() Hash {
return sCommit.hash
}
-// ObjectType allows Commit to satisfy the Object interface.
+// ObjectType returns the object type of the commit.
+//
+// It always returns ObjectTypeCommit.
func (commit *Commit) ObjectType() ObjectType {
_ = commit
return ObjectTypeCommit
@@ -128,7 +130,8 @@ func commitBody(c *Commit) ([]byte, error) {
return buf.Bytes(), nil
}
-// Serialize renders a Commit into canonical Git format.
+// Serialize renders the commit into its raw byte representation,
+// including the header (i.e., "type size\0").
func (commit *Commit) Serialize() ([]byte, error) {
body, err := commitBody(commit)
if err != nil {