2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-22 21:05:10 +00:00

lock: fix missing hint to unlock command if repository is locked

This commit is contained in:
Michael Eischer 2023-06-02 23:16:49 +02:00
parent 13c32b0fbe
commit 237d00000e
2 changed files with 3 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package main
import (
"context"
"fmt"
"sync"
"time"
@ -97,7 +98,7 @@ retryLoop:
return nil, ctx, errors.Fatalf("%v\n\nthe `unlock --remove-all` command can be used to remove invalid locks. Make sure that no other restic process is accessing the repository when running the command", err)
}
if err != nil {
return nil, ctx, errors.Fatalf("unable to create lock in backend: %v", err)
return nil, ctx, fmt.Errorf("unable to create lock in backend: %w", err)
}
debug.Log("create lock %p (exclusive %v)", lock, exclusive)

View File

@ -90,6 +90,7 @@ func TestLockConflict(t *testing.T) {
if err == nil {
t.Fatal("second lock should have failed")
}
test.Assert(t, restic.IsAlreadyLocked(err), "unexpected error %v", err)
}
type writeOnceBackend struct {