Skip to content

Fix empty files being excluded from restore list#110

Merged
babarot merged 1 commit intomainfrom
babarot/fix-empty-file-excluded-from-restore
Mar 20, 2026
Merged

Fix empty files being excluded from restore list#110
babarot merged 1 commit intomainfrom
babarot/fix-empty-file-excluded-from-restore

Conversation

@babarot
Copy link
Copy Markdown
Owner

@babarot babarot commented Mar 20, 2026

Summary

Fix a bug where empty (0-byte) files moved to trash are not shown in the restore TUI.

Background

Reported in Issue #107. When a user trashes an empty file created with touch, the file is correctly moved to trash, but never appears in the restore list. The root cause is the default min: 0KB config combined with the <= comparison in the size filter, which silently excludes zero-byte files.

Changes

  • filter.go: Change size comparison from <= to <. Files exactly matching the boundary are now included; only files strictly below min or strictly above max are excluded
  • defaults.go: Remove default Min: "0KB". The minimum size filter is now disabled by default
  • README.md: Update the size.min comment to reflect the new behavior
  • filter_test.go: Add test case verifying that empty files are included with min: 0KB

Closes #107

Change size filter comparison from <= to < so that files exactly
matching the boundary are included. Remove default min size (0KB)
to prevent zero-byte files from being silently excluded.

Closes #107
@babarot babarot added the kind/improvement An improvement to existing functionality; not a new feature or bug fix label Mar 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Code Metrics Report

main (cd458af) #110 (5d54b1a) +/-
Coverage 50.0% 50.0% 0.0%
Code to Test Ratio 1:0.8 1:0.8 +0.0
Test Execution Time 2s 2s 0s
Details
  |                     | main (cd458af) | #110 (5d54b1a) | +/-  |
  |---------------------|----------------|----------------|------|
  | Coverage            |          50.0% |          50.0% | 0.0% |
  |   Files             |             23 |             23 |    0 |
  |   Lines             |           1087 |           1087 |    0 |
  |   Covered           |            544 |            544 |    0 |
+ | Code to Test Ratio  |          1:0.8 |          1:0.8 | +0.0 |
  |   Code              |           2714 |           2713 |   -1 |
+ |   Test              |           2315 |           2321 |   +6 |
  | Test Execution Time |             2s |             2s |   0s |

Code coverage of files in pull request scope (97.5% β†’ 97.5%)

Files Coverage +/- Status
internal/config/defaults.go 100.0% 0.0% modified
internal/trash/filter.go 97.4% 0.0% modified

Reported by octocov

@babarot babarot marked this pull request as ready for review March 20, 2026 08:52
@babarot babarot merged commit 1e162c7 into main Mar 20, 2026
5 checks passed
@babarot babarot deleted the babarot/fix-empty-file-excluded-from-restore branch March 20, 2026 08:52
@github-actions github-actions bot mentioned this pull request Mar 20, 2026
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Mar 25, 2026
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [babarot/gomi](https://github.com/babarot/gomi) | patch | `v1.6.2` β†’ `v1.6.3` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>babarot/gomi (babarot/gomi)</summary>

### [`v1.6.3`](https://github.com/babarot/gomi/blob/HEAD/CHANGELOG.md#v163---2026-03-20)

[Compare Source](babarot/gomi@v1.6.2...v1.6.3)

##### Bug fixes

- Fix files with dollar signs in names being incorrectly expanded by [@&#8203;babarot](https://github.com/babarot) in [#&#8203;111](babarot/gomi#111)
- Fix cross-device link error in legacy storage by [@&#8203;babarot](https://github.com/babarot) in [#&#8203;112](babarot/gomi#112)

##### Improvements

- Fix empty files being excluded from restore list by [@&#8203;babarot](https://github.com/babarot) in [#&#8203;110](babarot/gomi#110)
- Fix gomi\_dir being ignored when strategy is auto by [@&#8203;babarot](https://github.com/babarot) in [#&#8203;113](babarot/gomi#113)
- Fix colors invisible on light terminal backgrounds by [@&#8203;babarot](https://github.com/babarot) in [#&#8203;114](babarot/gomi#114)

</details>

---

### Configuration

πŸ“… **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

β™» **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

πŸ”• **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My44Ny4xIiwidXBkYXRlZEluVmVyIjoiNDMuODcuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6OnBhdGNoIl19-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/improvement An improvement to existing functionality; not a new feature or bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simply can't get this working

1 participant