diff --git a/changelog/unreleased/pull-2821 b/changelog/unreleased/pull-2821 new file mode 100644 index 000000000..ee0d7b483 --- /dev/null +++ b/changelog/unreleased/pull-2821 @@ -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 diff --git a/cmd/restic/cmd_mount.go b/cmd/restic/cmd_mount.go index 59fb4e82a..626915dfe 100644 --- a/cmd/restic/cmd_mount.go +++ b/cmd/restic/cmd_mount.go @@ -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)