aboutsummaryrefslogtreecommitdiff
path: root/hash.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 /hash.go
parentSeparate stored object types from types that the user is expected to construct. (diff)
signature
Documentation overhaul
Diffstat (limited to 'hash.go')
-rw-r--r--hash.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/hash.go b/hash.go
index 98c36c2e..2278f7cc 100644
--- a/hash.go
+++ b/hash.go
@@ -8,7 +8,7 @@ import (
const maxHashSize = 32
-// Hash represents a Git object identifier.
+// Hash represents a Git object ID.
type Hash struct {
data [maxHashSize]byte
size int
@@ -35,12 +35,12 @@ var hashFuncs = map[int]hashFunc{
},
}
-// String returns the ID as hex using its internal size.
+// String returns a hexadecimal string representation of the hash.
func (hash Hash) String() string {
return hex.EncodeToString(hash.data[:hash.size])
}
-// Bytes returns a mutable copy of the underlying bytes using its internal size.
+// Bytes returns a mutable copy of the hash bytes.
func (hash Hash) Bytes() []byte {
return append([]byte(nil), hash.data[:hash.size]...)
}