mirror of
https://github.com/restic/restic.git
synced 2024-12-22 15:57:07 +00:00
Merge pull request #5096 from MichaelEischer/prune-allow-dry-run
prune: allow dry-run without taking a lock
This commit is contained in:
commit
e18a2a0072
2 changed files with 12 additions and 1 deletions
7
changelog/unreleased/pull-5096
Normal file
7
changelog/unreleased/pull-5096
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
Enhancement: Allow prune dry-run without lock
|
||||||
|
|
||||||
|
The `prune --dry-run --no-lock` now allows performing a dry-run without
|
||||||
|
taking a lock. If the repository is modified concurrently, `prune` may
|
||||||
|
return inaccurate statistics or errors.
|
||||||
|
|
||||||
|
https://github.com/restic/restic/pull/5096
|
|
@ -149,7 +149,11 @@ func runPrune(ctx context.Context, opts PruneOptions, gopts GlobalOptions, term
|
||||||
return errors.Fatal("disabled compression and `--repack-uncompressed` are mutually exclusive")
|
return errors.Fatal("disabled compression and `--repack-uncompressed` are mutually exclusive")
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, repo, unlock, err := openWithExclusiveLock(ctx, gopts, false)
|
if gopts.NoLock && !opts.DryRun {
|
||||||
|
return errors.Fatal("--no-lock is only applicable in combination with --dry-run for prune command")
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx, repo, unlock, err := openWithExclusiveLock(ctx, gopts, opts.DryRun && gopts.NoLock)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue