Skip to content

Enhancement: Add --ignore-casing option for snapshot filtering#5686

Open
Paulomen2712 wants to merge 12 commits into
restic:masterfrom
Paulomen2712:ignore-casing-group-by
Open

Enhancement: Add --ignore-casing option for snapshot filtering#5686
Paulomen2712 wants to merge 12 commits into
restic:masterfrom
Paulomen2712:ignore-casing-group-by

Conversation

@Paulomen2712

@Paulomen2712 Paulomen2712 commented Jan 28, 2026

Copy link
Copy Markdown
Contributor

What does this PR change? What problem does it solve?

Snapshot filtering required exact casing for host, tag, and path values. This change adds case-insensitive filtering, allowing snapshots to be reliably selected regardless of how hosts, tags, or paths are capitalized.

Was the change previously discussed in an issue or on the forum?

Closes #2331

Checklist

  • I have added tests for all code changes.
  • I have added documentation for relevant changes (in the manual).
  • There's a new file in changelog/unreleased/ that describes the changes for our users (see template).
  • I'm done! This pull request is ready for review.

@Paulomen2712 Paulomen2712 force-pushed the ignore-casing-group-by branch from cadca19 to 52dc9c5 Compare January 28, 2026 15:39
dependabot Bot and others added 6 commits January 28, 2026 16:42
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 8 to 9.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](golangci/golangci-lint-action@v8...v9)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-version: '9'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [github.com/ncw/swift/v2](https://github.com/ncw/swift) from 2.0.4 to 2.0.5.
- [Release notes](https://github.com/ncw/swift/releases)
- [Changelog](https://github.com/ncw/swift/blob/master/RELEASE.md)
- [Commits](ncw/swift@v2.0.4...v2.0.5)

---
updated-dependencies:
- dependency-name: github.com/ncw/swift/v2
  dependency-version: 2.0.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Introduce a new --ignore-case option to make --group-by comparisons case-insensitive
in the "snapshots" and "forget" commands. Also added it to other commands that use snapshot filters.
This allows users in environments
with inconsistent host, path, or tag casing to list or
remove snapshots without worrying about exact casing.
@Paulomen2712 Paulomen2712 force-pushed the ignore-casing-group-by branch from 52dc9c5 to ce46ed6 Compare January 28, 2026 15:43
@Paulomen2712 Paulomen2712 force-pushed the ignore-casing-group-by branch from ac973f4 to b3e135f Compare January 28, 2026 15:57
@Paulomen2712 Paulomen2712 changed the title Ignore casing group by Enhancement: Add --ignore-casing option for snapshot filtering Feb 2, 2026
@Paulomen2712 Paulomen2712 changed the title Enhancement: Add --ignore-casing option for snapshot filtering Enhancement: Add --ignore-casing option for snapshot filtering Feb 2, 2026
@Paulomen2712 Paulomen2712 changed the title Enhancement: Add --ignore-casing option for snapshot filtering Enhancement: Add --ignore-casing option for snapshot filtering Feb 2, 2026
@wplapper

wplapper commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

Hi @Paulomen2712,

now that PR #5688 has been merged into master, your code can be simplified: just remove your changes for cmd_ls.go, cmd_restore.go and cmd_dump.go.
Please also remove doc/bash-completion.sh since this file is auto generated in each new release for restic.

Actually all restic commands, which use a data.SnapshotFilterare now in a position to use case insensitive snapshot filtering, as indicated in doc/045_working_with_repos.rst Fix changelog/unreleased/issue-2331 for correct description.

Please create an example for case insensitive --path filtering. Make a backup of a directory structure which starts with /Home/Kasimir and show that case insensitive path filtering for /home/kasimir works. Backup names are your choice, but they should contain at least one uppercase character per path element. Use restic ls latest --path ... --ignore-case and additional subfolder filtering, e.g. restic -r .. ls latest --path /home/kasimir --ignore-case /home/kasimir/restic/cmd/restic. I know it is a tricky example, but will it ever work?

@Paulomen2712 Paulomen2712 force-pushed the ignore-casing-group-by branch from 5850fc7 to 112d4fa Compare February 5, 2026 10:10
@Paulomen2712

Copy link
Copy Markdown
Contributor Author

Hi @Paulomen2712,

now that PR #5688 has been merged into master, your code can be simplified: just remove your changes for cmd_ls.go, cmd_restore.go and cmd_dump.go. Please also remove doc/bash-completion.sh since this file is auto generated in each new release for restic.

Actually all restic commands, which use a data.SnapshotFilterare now in a position to use case insensitive snapshot filtering, as indicated in doc/045_working_with_repos.rst Fix changelog/unreleased/issue-2331 for correct description.

Please create an example for case insensitive --path filtering. Make a backup of a directory structure which starts with /Home/Kasimir and show that case insensitive path filtering for /home/kasimir works. Backup names are your choice, but they should contain at least one uppercase character per path element. Use restic ls latest --path ... --ignore-case and additional subfolder filtering, e.g. restic -r .. ls latest --path /home/kasimir --ignore-case /home/kasimir/restic/cmd/restic. I know it is a tricky example, but will it ever work?

Hi @wplapper,

Thank you so much for your review!

I didn't realise that the doc/bash-completion.sh was auto-generated. I have promptly fixed this along with the changelog.

Also thank you for working on PR #5688 which does indeed simplify stuff for the commands.

Regarding the example, I tested with the following output and adapted it for the docs:

restic ls latest --path /root/test --ignore-case
repository 2e835fc1 opened (version 2, compression level auto)
[0:00] 100.00%  3 / 3 index files loaded
snapshot 75332ff9 of [/root/Test] at 2026-02-05 10:43:01.383244019 +0100 CET by root filtered by []:
/root
/root/Test

@Paulomen2712 Paulomen2712 mentioned this pull request Feb 20, 2026
2 tasks
@Paulomen2712 Paulomen2712 force-pushed the ignore-casing-group-by branch from 80efa70 to 70cff4c Compare March 17, 2026 14:44
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.

An -i switch to ignore case for --group-by options in "snapshots" and "forget"

3 participants