From 7af69fd7b9b05f792eb4c8d020e1b82bf226a26d Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Sat, 5 Mar 2022 10:29:13 +0100 Subject: [PATCH] list: Never lock the repository when listing lock files There's no point in locking the repository just to list the currently existing lock files. This won't work for an exclusively locked repository and is also confusing to users. --- changelog/unreleased/issue-1106 | 10 ++++++++++ cmd/restic/cmd_list.go | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 changelog/unreleased/issue-1106 diff --git a/changelog/unreleased/issue-1106 b/changelog/unreleased/issue-1106 new file mode 100644 index 000000000..1df3e1981 --- /dev/null +++ b/changelog/unreleased/issue-1106 @@ -0,0 +1,10 @@ +Bugfix: Never lock repository for `list locks` + +The `list locks` command previously locked to the repository by default. This +has the problem that it won't work for an exclusively locked repository and +that the command will also display its own lock file which can be confusing. + +Now, the `list locks` command cnever locks the repository. + +https://github.com/restic/restic/issues/1106 +https://github.com/restic/restic/pull/3665 diff --git a/cmd/restic/cmd_list.go b/cmd/restic/cmd_list.go index af711da3d..811b17e41 100644 --- a/cmd/restic/cmd_list.go +++ b/cmd/restic/cmd_list.go @@ -39,7 +39,7 @@ func runList(cmd *cobra.Command, opts GlobalOptions, args []string) error { return err } - if !opts.NoLock { + if !opts.NoLock && args[0] != "locks" { lock, err := lockRepo(opts.ctx, repo) defer unlockRepo(lock) if err != nil {