diff options
Diffstat (limited to 'format')
| -rw-r--r-- | format/commitgraph/read/read_test.go | 10 | ||||
| -rw-r--r-- | format/pack/ingest/stream.go | 5 |
2 files changed, 3 insertions, 12 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) diff --git a/format/pack/ingest/stream.go b/format/pack/ingest/stream.go index 66a6fc5f..a403087a 100644 --- a/format/pack/ingest/stream.go +++ b/format/pack/ingest/stream.go @@ -69,10 +69,7 @@ func (scanner *streamScanner) Read(dst []byte) (int, error) { return 0, io.EOF } - n := len(dst) - if n > unread { - n = unread - } + n := min(len(dst), unread) copy(dst, scanner.buf[scanner.off:scanner.off+n]) |
