2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-22 21:05:10 +00:00

rewrite: non-exclusive lock if snapshots are only added

This commit is contained in:
Michael Eischer 2022-09-09 22:47:31 +02:00
parent 327f418a9c
commit 375a3db64d

View File

@ -161,9 +161,14 @@ func runRewrite(ctx context.Context, opts RewriteOptions, gopts GlobalOptions, a
}
if !opts.DryRun {
Verbosef("create exclusive lock for repository\n")
var lock *restic.Lock
lock, ctx, err = lockRepoExclusive(ctx, repo)
var err error
if opts.Inplace {
Verbosef("create exclusive lock for repository\n")
lock, ctx, err = lockRepoExclusive(ctx, repo)
} else {
lock, ctx, err = lockRepo(ctx, repo)
}
defer unlockRepo(lock)
if err != nil {
return err