aboutsummaryrefslogtreecommitdiff
path: root/objects_test.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2025-11-15 00:00:00 +0000
committerGravatar Runxi Yu2025-11-15 00:00:00 +0000
commit6655e9f74eac800e26f57ebdb143111726e8b73d (patch)
treedb36fffb1dac361f0ca42023d747081fefaeb14f /objects_test.go
parentAdd initial support for multi pack indexes (diff)
signature
Use SHA-256 by default
Diffstat (limited to 'objects_test.go')
-rw-r--r--objects_test.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/objects_test.go b/objects_test.go
index b5b3c5b9..2bb0d486 100644
--- a/objects_test.go
+++ b/objects_test.go
@@ -26,8 +26,11 @@ func hashWithByte(fill byte) Hash {
}
func TestLoosePathUsesExpectedLayout(t *testing.T) {
- id := mustHash(t, "0123456789abcdef0123456789abcdef01234567")
- expect := filepath.Join("objects", "01", "23456789abcdef0123456789abcdef01234567")
+ pattern := "0123456789abcdef"
+ repeats := (HashSize*2 + len(pattern) - 1) / len(pattern)
+ hexStr := strings.Repeat(pattern, repeats)[:HashSize*2]
+ id := mustHash(t, hexStr)
+ expect := filepath.Join("objects", hexStr[:2], hexStr[2:])
if got := loosePath(id); got != expect {
t.Fatalf("unexpected loose path: %q", got)
}