Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
510b545ae5 |
@@ -410,8 +410,8 @@ func userVersion(ctx context.Context, db *sql.DB) (int, error) {
|
|||||||
func loadFileRows(ctx context.Context, db *sql.DB, total func(n int64),
|
func loadFileRows(ctx context.Context, db *sql.DB, total func(n int64),
|
||||||
fn func(r scanRec),
|
fn func(r scanRec),
|
||||||
) error {
|
) error {
|
||||||
// Everything goes through tx: the report connection is the only
|
// Everything goes through tx: db has one connection, so a query on
|
||||||
// one, so a query on db would wait for tx forever.
|
// db would wait for tx forever.
|
||||||
tx, err := db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})
|
tx, err := db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("read records: %w", err)
|
return fmt.Errorf("read records: %w", err)
|
||||||
|
|||||||
+1
-1
@@ -297,7 +297,7 @@ func (p *progress) warnf(format string, args ...any) {
|
|||||||
// "sfdupes trees". It holds what is written to it and writes that to
|
// "sfdupes trees". It holds what is written to it and writes that to
|
||||||
// out in pieces of about ioBufSize bytes, each under the display's
|
// out in pieces of about ioBufSize bytes, each under the display's
|
||||||
// lock with the display cleared first, as warnf does for a warning: no
|
// lock with the display cleared first, as warnf does for a warning: no
|
||||||
// draw lands in the middle of a piece, and the next one shows the
|
// draw lands in the middle of a piece, and the next draw shows the
|
||||||
// display again, on the line below. Every write to it must end with a
|
// display again, on the line below. Every write to it must end with a
|
||||||
// newline, as a row written with one fmt.Fprintf does, so that each
|
// newline, as a row written with one fmt.Fprintf does, so that each
|
||||||
// piece ends a line. Flush writes what it holds once the last row is
|
// piece ends a line. Flush writes what it holds once the last row is
|
||||||
|
|||||||
+8
-3
@@ -5,7 +5,6 @@ import (
|
|||||||
"math"
|
"math"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"slices"
|
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
@@ -613,8 +612,14 @@ func TestProgressWriterRowsOnOwnLines(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !slices.Equal(shown, want) {
|
if len(shown) != len(want) {
|
||||||
t.Errorf("terminal shows rows %q, want %q", shown, want)
|
t.Fatalf("terminal shows %d rows, want %d", len(shown), len(want))
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := range want {
|
||||||
|
if shown[i] != want[i] {
|
||||||
|
t.Fatalf("terminal shows %q, want %q", shown[i], want[i])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user