shithub: furgit

Download patch

ref: 6cf63c5de9bb7f894d752caf72ab8326ac0c25da
parent: b022f7f8f3515e81d584048b4d953966dd0eb3f2
author: Runxi Yu <me@runxiyu.org>
date: Fri Feb 20 17:37:34 EST 2026

oid: Remove these unnecessary checks too

--- a/oid/objectid.go
+++ b/oid/objectid.go
@@ -141,9 +141,6 @@
 // String returns the canonical hex representation.
 func (id ObjectID) String() string {
 	size := id.Size()
-	if size == 0 {
-		return ""
-	}
 	return hex.EncodeToString(id.data[:size])
 }
 
@@ -150,9 +147,6 @@
 // Bytes returns a copy of the object ID bytes.
 func (id ObjectID) Bytes() []byte {
 	size := id.Size()
-	if size == 0 {
-		return nil
-	}
 	return append([]byte(nil), id.data[:size]...)
 }
 
--