shithub: furgit

Download patch

ref: 0591334a91e75fb48a081f3130d9633ef0523c5c
parent: 33d354ebca84f2901de2ac290e7af2696b0ea8fa
author: Runxi Yu <me@runxiyu.org>
date: Fri Feb 20 21:07:45 EST 2026

object: Right, I could use Cut here

--- a/object/ident.go
+++ b/object/ident.go
@@ -39,16 +39,16 @@
 		return nil, errors.New("object: ident: missing timestamp separator")
 	}
 	rest = rest[1:]
-	sp := bytes.IndexByte(rest, ' ')
-	if sp < 0 {
+	before, after, ok := bytes.Cut(rest, []byte{' '})
+	if !ok {
 		return nil, errors.New("object: ident: missing timezone separator")
 	}
-	when, err := strconv.ParseInt(string(rest[:sp]), 10, 64)
+	when, err := strconv.ParseInt(string(before), 10, 64)
 	if err != nil {
 		return nil, fmt.Errorf("object: ident: invalid timestamp: %w", err)
 	}
 
-	tz := rest[sp+1:]
+	tz := after
 	if len(tz) < 5 {
 		return nil, errors.New("object: ident: invalid timezone encoding")
 	}
--- a/object/tree.go
+++ b/object/tree.go
@@ -113,10 +113,7 @@
 		searchLen++
 	}
 
-	n := entryLen
-	if searchLen < n {
-		n = searchLen
-	}
+	n := min(searchLen, entryLen)
 
 	for i := 0; i < n; i++ {
 		var ec, sc byte
--