proposal: limit report and trees to given paths #174

Closed
opened 2026-11-11 01:06:02 +01:00 by clawbot · 3 comments
Collaborator

Proposal from the acceptance test (#164). It needs your decision before anyone builds it.

What is missing

report and trees always print every duplicate in the database. Neither takes a path. One database holds the whole machine, since the default path and dwim both lead there, so a user who wants the duplicates under one directory gets all of them.

Example: the natural command fails, with a message about commands:

$ sfdupes report /srv/photos
Error: unknown command "/srv/photos" for "sfdupes report"

Filtering the output does not give the answer either. Take three copies, /a/f, /srv/photos/x and /srv/photos/y. The rows are /a/f with /srv/photos/x, and /a/f with /srv/photos/y. No row pairs the two copies inside /srv/photos, so keeping the rows whose two paths are both under /srv/photos shows nothing. The summary totals also stay those of the whole database.

The way out today is a second database per tree, set through SFDUPES_DATABASE, which hashes those files again.

Why a user expects it

Every duplicate finder takes the directories to compare, as in fdupes -r /srv/photos. With sfdupes that choice exists only at scan time.

What it would take

  • report PATH... and trees PATH... use only the records at or below the given paths, then group, order and total as they do now.
  • The paths are taken as written, made absolute, and not looked up on the filesystem, since the reports never touch it.
  • With no path, the output is today's.
  • dwim is not affected.

Your choices

  • Reports take paths: build the above.
  • Leave as is: one report for the whole database. The misleading unknown command message is then fixed on its own.

Recommended: Reports take paths.

Model: fable-5-2

Proposal from the acceptance test (https://git.eeqj.de/sneak/sfdupes/issues/164). It needs your decision before anyone builds it. ## What is missing `report` and `trees` always print every duplicate in the database. Neither takes a path. One database holds the whole machine, since the default path and `dwim` both lead there, so a user who wants the duplicates under one directory gets all of them. Example: the natural command fails, with a message about commands: ``` $ sfdupes report /srv/photos Error: unknown command "/srv/photos" for "sfdupes report" ``` Filtering the output does not give the answer either. Take three copies, `/a/f`, `/srv/photos/x` and `/srv/photos/y`. The rows are `/a/f` with `/srv/photos/x`, and `/a/f` with `/srv/photos/y`. No row pairs the two copies inside `/srv/photos`, so keeping the rows whose two paths are both under `/srv/photos` shows nothing. The summary totals also stay those of the whole database. The way out today is a second database per tree, set through `SFDUPES_DATABASE`, which hashes those files again. ## Why a user expects it Every duplicate finder takes the directories to compare, as in `fdupes -r /srv/photos`. With `sfdupes` that choice exists only at scan time. ## What it would take - `report PATH...` and `trees PATH...` use only the records at or below the given paths, then group, order and total as they do now. - The paths are taken as written, made absolute, and not looked up on the filesystem, since the reports never touch it. - With no path, the output is today's. - `dwim` is not affected. ## Your choices - **Reports take paths**: build the above. - **Leave as is**: one report for the whole database. The misleading `unknown command` message is then fixed on its own. Recommended: **Reports take paths**. Model: fable-5-2
sneak was assigned by clawbot 2026-11-11 01:06:02 +01:00
Owner

rec approved

rec approved
Author
Collaborator

sneak approved the recommendation above (chat via tracker, 11 November about 02:20 UTC); it is the definition of done, built as one PR into next with tests and README changes.

Model: opus-5-5

sneak approved the recommendation above (chat via tracker, 11 November about 02:20 UTC); it is the definition of done, built as one PR into `next` with tests and README changes. Model: opus-5-5
sneak was unassigned by clawbot 2026-11-11 03:24:02 +01:00
Author
Collaborator

Built in #191: report and trees take optional PATH operands and use only the records at or below them. trees reports no directory above an operand, since its digest covers only part of its files. Operands are cleaned as text (., .., slashes), never looked up on the filesystem.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/sfdupes/pulls/191: `report` and `trees` take optional `PATH` operands and use only the records at or below them. `trees` reports no directory above an operand, since its digest covers only part of its files. Operands are cleaned as text (`.`, `..`, slashes), never looked up on the filesystem. Model: opus-5-5
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/sfdupes#174