aboutsummaryrefslogtreecommitdiff
path: root/ident.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2025-11-16 00:00:00 +0000
committerGravatar Runxi Yu2025-11-16 00:00:00 +0000
commitb6d4ab71d42234a4ae2678083d1b7558b8e6519f (patch)
tree993c8a56ee9b2a72237e29cbf41767d4986c2fc5 /ident.go
parenthash: Make fewer helper functions need explicit hash length fields (diff)
signature
Make the API more consistent
Diffstat (limited to 'ident.go')
-rw-r--r--ident.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/ident.go b/ident.go
index 48230182..1d756695 100644
--- a/ident.go
+++ b/ident.go
@@ -94,17 +94,17 @@ func parseIdent(line []byte) (*Ident, error) {
}
// Serialize renders an Ident into canonical Git format.
-func (id Ident) Serialize() []byte {
+func (ident Ident) Serialize() []byte {
var b strings.Builder
- b.Grow(len(id.Name) + len(id.Email) + 32)
- b.Write(id.Name)
+ b.Grow(len(ident.Name) + len(ident.Email) + 32)
+ b.Write(ident.Name)
b.WriteString(" <")
- b.Write(id.Email)
+ b.Write(ident.Email)
b.WriteString("> ")
- b.WriteString(strconv.FormatInt(id.WhenUnix, 10))
+ b.WriteString(strconv.FormatInt(ident.WhenUnix, 10))
b.WriteByte(' ')
- offset := id.OffsetMinutes
+ offset := ident.OffsetMinutes
sign := '+'
if offset < 0 {
sign = '-'
@@ -117,7 +117,7 @@ func (id Ident) Serialize() []byte {
}
// When returns the timestamp as time.Time using the embedded offset.
-func (id Ident) When() time.Time {
- loc := time.FixedZone("git", int(id.OffsetMinutes)*60)
- return time.Unix(id.WhenUnix, 0).In(loc)
+func (ident Ident) When() time.Time {
+ loc := time.FixedZone("git", int(ident.OffsetMinutes)*60)
+ return time.Unix(ident.WhenUnix, 0).In(loc)
}