Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prune: Handle --max-repack-size=0 as expected #3591

Merged
merged 1 commit into from
Jan 13, 2022

Conversation

MichaelEischer
Copy link
Member

@MichaelEischer MichaelEischer commented Dec 7, 2021

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

Previously the flag was ignored and --max-repack-size=1 had to be
used instead.

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

Mentioned in #1153.

Checklist

  • I have read the contribution guidelines.
  • I have enabled maintainer edits.
  • [ ] 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 have run gofmt on the code in all commits.
  • All commit messages are formatted in the same style as the other commits in the repo.
  • I'm done! This pull request is ready for review.

@greatroar
Copy link
Contributor

LGTM.

@MichaelEischer MichaelEischer force-pushed the prune-fix-max-repack branch 2 times, most recently from 39fa499 to 04cc82e Compare December 27, 2021 14:45
Previously the flag was ignored and `--max-repack-size=1` had to be
used.
if opts.MaxRepackBytes > 0 {
reachedRepackSize = stats.size.repack+p.unusedSize+p.usedSize > opts.MaxRepackBytes
}
reachedRepackSize := stats.size.repack+p.unusedSize+p.usedSize >= opts.MaxRepackBytes
Copy link
Member Author

Choose a reason for hiding this comment

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

I've change the comparison to >=. This ensures that --max-repack-size=0 really repacks nothing at all.

Copy link
Contributor

@rawtaz rawtaz left a comment

Choose a reason for hiding this comment

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

Looks right to me.

@rawtaz rawtaz merged commit abfbacf into restic:master Jan 13, 2022
@rawtaz rawtaz mentioned this pull request Jan 13, 2022
8 tasks
@MichaelEischer MichaelEischer deleted the prune-fix-max-repack branch January 14, 2022 19:52
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.

None yet

3 participants