forked from TrueCloudLab/restic
Merge pull request #2821 from renard/mount-nolock
cmd/mount: honur --no-lock flag
This commit is contained in:
commit
5af2815627
2 changed files with 14 additions and 4 deletions
8
changelog/unreleased/pull-2821
Normal file
8
changelog/unreleased/pull-2821
Normal file
|
@ -0,0 +1,8 @@
|
|||
Change: Honor the --no-lock flag in the mount command
|
||||
|
||||
The mount command now does not lock the repository if given the
|
||||
--no-lock flag. This allows to mount repositories which are archived
|
||||
on a read only backend/filesystem.
|
||||
|
||||
https://github.com/restic/restic/issues/1597
|
||||
https://github.com/restic/restic/pull/2821
|
|
@ -90,10 +90,12 @@ func mount(opts MountOptions, gopts GlobalOptions, mountpoint string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
lock, err := lockRepo(repo)
|
||||
defer unlockRepo(lock)
|
||||
if err != nil {
|
||||
return err
|
||||
if !gopts.NoLock {
|
||||
lock, err := lockRepo(repo)
|
||||
defer unlockRepo(lock)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
err = repo.LoadIndex(gopts.ctx)
|
||||
|
|
Loading…
Reference in a new issue