cat: Respect --no-lock flag

This commit is contained in:
Kyle Brennan 2020-11-25 23:04:46 -08:00 committed by Alexander Neumann
parent 9a97095a4c
commit 666768cd17
2 changed files with 12 additions and 4 deletions

View file

@ -0,0 +1,5 @@
Bugfix: Make cat command respect --no-lock
Restic cat would not respect the --no-lock flag, it now does.
https://github.com/restic/restic/issues/2739

View file

@ -42,10 +42,13 @@ func runCat(gopts GlobalOptions, args []string) error {
return err
}
lock, err := lockRepo(gopts.ctx, repo)
defer unlockRepo(lock)
if err != nil {
return err
if !gopts.NoLock {
lock, err := lockRepo(gopts.ctx, repo)
// Make the linter happy
if err != nil {
return err
}
defer func() { _ = unlockRepo(lock) }()
}
tpe := args[0]