aboutsummaryrefslogtreecommitdiff
path: root/format/commitgraph/read
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-06 13:11:56 +0800
committerGravatar Runxi Yu2026-03-06 13:12:06 +0800
commit195447b77ff5fc37e184d2d0e7aae99aec250d8c (patch)
treec683dc459d333e8b8c71689b9d2cd3d9e8649650 /format/commitgraph/read
parentformat/pack/ingest: I don't think we need to use a clone there (diff)
signatureNo signature
*: go fix ./...
Diffstat (limited to 'format/commitgraph/read')
-rw-r--r--format/commitgraph/read/read_test.go10
1 files changed, 2 insertions, 8 deletions
diff --git a/format/commitgraph/read/read_test.go b/format/commitgraph/read/read_test.go
index 0efd67ca..80091c5b 100644
--- a/format/commitgraph/read/read_test.go
+++ b/format/commitgraph/read/read_test.go
@@ -76,10 +76,7 @@ func TestReadSingleMatchesGit(t *testing.T) {
}
}
- step := len(allIDs) / 24
- if step < 1 {
- step = 1
- }
+ step := max(len(allIDs)/24, 1)
for i, id := range allIDs {
if i%step != 0 && i != len(allIDs)-1 {
@@ -117,10 +114,7 @@ func TestReadChainMatchesGit(t *testing.T) {
t.Fatalf("NumCommits() = %d, want %d", got, len(allIDs))
}
- step := len(allIDs) / 20
- if step < 1 {
- step = 1
- }
+ step := max(len(allIDs)/20, 1)
for i, id := range allIDs {
pos, err := reader.Lookup(id)