Name the database each command uses on stderr (closes #111)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
scan, report and trees now print one line on stderr before anything else, naming the database as an absolute path and saying whether the path is the default or comes from SFDUPES_DATABASE; scan also says when no database file exists yet. report and trees print it before opening the database, so a missing-database error follows it. databasePath in db.go now returns the absolute path and its source, and every command uses that absolute path throughout, so errors and the lock file name it too. README "Database" lists when scan writes each file, from the lock file to the -wal and -shm files going away. Unverified: the line on a terminal has no test of its own; it is printed before any progress display, the same way in both cases. Model: opus-5-5
This commit is contained in:
+6
-4
@@ -344,9 +344,10 @@ func storedPaths(t *testing.T, path string) []string {
|
||||
|
||||
// TestRunScanInterrupted calls the scan entrypoint with a context that
|
||||
// is already cancelled, as when a signal arrives at once. It must return
|
||||
// errInterrupted promptly with its one line on stderr and nothing on
|
||||
// stdout, leave the database valid and as it was, and leave nothing in
|
||||
// the way of the next scan, which must bring the database up to date.
|
||||
// errInterrupted promptly, with its line on stderr after the one naming
|
||||
// the database and nothing on stdout, leave the database valid and as
|
||||
// it was, and leave nothing in the way of the next scan, which must
|
||||
// bring the database up to date.
|
||||
func TestRunScanInterrupted(t *testing.T) {
|
||||
path := testDBPath(t)
|
||||
t.Setenv(databaseEnv, path)
|
||||
@@ -389,7 +390,8 @@ func TestRunScanInterrupted(t *testing.T) {
|
||||
err, errInterrupted)
|
||||
}
|
||||
|
||||
want := "scan: interrupted after 0 files\n"
|
||||
want := "scan: database " + path + " (from " + databaseEnv + ")\n" +
|
||||
"scan: interrupted after 0 files\n"
|
||||
if got := stderr()[shown:]; got != want {
|
||||
t.Errorf("stderr = %q, want %q", got, want)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user