2
2
mirror of https://github.com/octoleo/restic.git synced 2024-06-01 08:30:49 +00:00

Merge pull request #3589 from metalsp0rk/copy-no-lock

Make Copy respect no lock
This commit is contained in:
MichaelEischer 2021-12-27 19:11:02 +01:00 committed by GitHub
commit 051cc7ce71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 4 deletions

View File

@ -0,0 +1,9 @@
Bugfix: Make copy command honor `--no-lock` for source repository
When passing the `--no-lock` flag to the copy command, restic still attempted
to lock the source repository, causing failures on read-only storage backends.
`--no-lock` is now respected and copy then no longer creates a lock in the
source repository.
https://github.com/restic/restic/issues/3518
https://github.com/restic/restic/pull/3589

View File

@ -73,10 +73,12 @@ func runCopy(opts CopyOptions, gopts GlobalOptions, args []string) error {
return err
}
srcLock, err := lockRepo(ctx, srcRepo)
defer unlockRepo(srcLock)
if err != nil {
return err
if !gopts.NoLock {
srcLock, err := lockRepo(ctx, srcRepo)
defer unlockRepo(srcLock)
if err != nil {
return err
}
}
dstLock, err := lockRepo(ctx, dstRepo)