Skip to content

Say nothing to delete instead of asking to delete zero files [patch] - #183

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/176-nothing-to-delete
Oct 9, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/176-nothing-to-delete

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #176

Summary

Empty files stopped being deleted in #151. Since then, a tree whose only duplicates are empty marker files (__init__.py, .gitkeep) planned zero deletions but still reached Proceed with deletion? (y/N). A non-interactive run read EOF, printed Aborted. and exited 1.

  • Deduplicate: right after PlanDeletions, when plan.FileCount == 0 it prints Nothing to delete (only empty-file duplicates found). and returns with exit code 0. It no longer prompts or reads stdin.
  • Scan: prints the "Run the 'Deduplicate' command" hint only when at least one group has a deletable copy.

DryRun and Stats already report Files to delete: 0 and Empty duplicates (never deleted) accurately, so they are unchanged.

Tests

  • OnlyEmptyDuplicatesSkipTheConfirmationAndSucceed: runs with empty stdin and asserts exit 0, no prompt, no Aborted., and that both empty files survive.
  • ScanDoesNotSuggestDeduplicateWhenOnlyEmptyDuplicatesExist
  • With the fix reverted, both new tests fail. With it applied, the full suite passes (103 passed, 3 skipped).

🤖 Generated with Claude Code

https://claude.ai/code/session_019BwRbgKQMY5pZraxHBjxqM


Generated by Claude Code

Since empty files stopped being deleted, a tree whose only duplicates
are empty marker files (__init__.py, .gitkeep) planned zero deletions
but still reached the confirmation prompt, so a non-interactive run
read EOF, printed "Aborted." and exited 1.

Deduplicate now returns early with exit 0 when the plan deletes
nothing, and Scan only suggests Deduplicate when some group has a
deletable copy.

Fixes #176

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019BwRbgKQMY5pZraxHBjxqM
@sonarqubecloud

sonarqubecloud Bot commented Oct 9, 2026

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit bd6f18b into main Oct 9, 2026
14 checks passed
@matt-edmondson
matt-edmondson deleted the fix/176-nothing-to-delete branch October 9, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deduplicate prompts "Proceed with deletion?" when only empty-file duplicates exist (0 files to delete), and declining or EOF exits 1

2 participants