Merge pull request #656 from rustic-rs/prune-max-repack

prune: fix --max-repack
This commit is contained in:
aawsome 2023-06-05 08:58:42 +02:00 committed by GitHub
commit 409dc0a7aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -5,6 +5,7 @@ Breaking changes:
Bugs fixed:
- backup crashed when there was a non-unicode link target. The crash has been fixed. However, non-unicode link targets are still unsupported.
- Extended attributes which were saved with value null couldn't be handled. This has been fixed.
- prune: --max-repack didn't work with a given percentage of repo size. This has been fixed.
New features:
- copy: Added --init option to initialize uninitialized target repos

View File

@ -574,7 +574,7 @@ impl Pruner {
let max_repack = match max_repack {
LimitOption::Unlimited => u64::MAX,
LimitOption::Size(size) => size.as_u64(),
LimitOption::Percentage(p) => p * self.stats.size.sum().total(),
LimitOption::Percentage(p) => (p * self.stats.size.sum().total()) / 100,
};
self.repack_candidates.sort_unstable_by_key(|rc| rc.0);