forked from TrueCloudLab/restic
Merge pull request #3125 from metalsp0rk/cat-respect-no-lock
Make restic cat respect --no-lock
This commit is contained in:
commit
2f9346a5af
2 changed files with 17 additions and 4 deletions
5
changelog/unreleased/issue-2739
Normal file
5
changelog/unreleased/issue-2739
Normal 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
|
|
@ -42,10 +42,18 @@ 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)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defer func() {
|
||||
err := unlockRepo(lock)
|
||||
if err != nil {
|
||||
Warnf("unlock repo failed: %v", err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
tpe := args[0]
|
||||
|
|
Loading…
Reference in a new issue