1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-27 02:08:37 +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)