Skip to content

Enhancement: calls to SnapshotFilter.FindLatest() can be simplified#5688

Merged
MichaelEischer merged 3 commits into
restic:masterfrom
wplapper:findLatest
Jan 31, 2026
Merged

Enhancement: calls to SnapshotFilter.FindLatest() can be simplified#5688
MichaelEischer merged 3 commits into
restic:masterfrom
wplapper:findLatest

Conversation

@wplapper

@wplapper wplapper commented Jan 30, 2026

Copy link
Copy Markdown
Contributor

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

This PR simplifies the code logic to call opts.SnapshotFilter.FindLatest(). There is a unnecessary creation of a temp SnapshotFilter, when the original will do quite nicely. I saw this when reviewing PR #5686. It will also simplify the code
for new filter components, when all this new code can be hidden in ìnternal/data/snapshot_find.go.

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

No.

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.

added a new file doc/view_repository.rst which contains a
descrption of the `restic list`command.
This reverts commit ab5c259.
By mistake I was in the wrong branch
is too complex. Since all the fields of the Snapshotfilter are copied to a new filter,
there is nothing gained in doing so. The other field `TimestampLimit` cannot be
referenced from the command line - and only `restic backup` uses this field.

JUst remove the copying of all these fields and use the original Filter instead.
@wplapper wplapper changed the title Enhancement: SnapshotFilter.FindLatest can be simplified Enhancement: calls to SnapshotFilter.FindLatest() can be simplified Jan 30, 2026
@wplapper

wplapper commented Jan 30, 2026

Copy link
Copy Markdown
Contributor Author

Ignore the first two commits - they are shadows of what I did wrong in git. But I don't know of how to get rid of them safely.

@MichaelEischer MichaelEischer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I hope that it made sense at some point in the past 😅 . Thanks!

I'll just squash the commits of this PR. To get rid of the two extra commits there are basically two options either use rebase or just throw away the commits and recreate them:

# remove the two lines for the unwanted commits
# there are also lots of tools/helpers for interactive git rebase
git rebase --interactive HEAD~3

or

git reset HEAD~3
git add .
git commit 

@MichaelEischer MichaelEischer merged commit bcd4168 into restic:master Jan 31, 2026
11 checks passed
@wplapper wplapper deleted the findLatest branch February 1, 2026 06:16
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.

2 participants