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:
commit
051cc7ce71
2 changed files with 15 additions and 4 deletions
9
changelog/unreleased/issue-3518
Normal file
9
changelog/unreleased/issue-3518
Normal 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
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue