Skip to content

Commit 0b0b4f0

Browse files
authored
Explain how to break locks on a repo
1 parent f100eb1 commit 0b0b4f0

9 files changed

+9
-9
lines changed

cmd/add.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ You must specify a destination, which is a folder inside the repository where yo
8888
err = store.AcquireLock(ctx)
8989
cancel()
9090
if err != nil {
91-
return NewExecError(ErrorApp, "Could not acquire a lock. Please make sure that no other instance of prvt is running with the same repo.", err)
91+
return NewExecError(ErrorApp, "Could not acquire a lock. Please make sure that no other instance of prvt is running with the same repo.\nIf you believe this is a mistake, you can forcefully break all locks with the \"prvt repo lock-break\" command.\nIf you believe this is a mistake, you can forcefully break all locks with the \"prvt repo lock-break\" command.", err)
9292
}
9393
defer store.ReleaseLock(context.Background())
9494

cmd/repo-init.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ In order to use GPG keys, you need to have GPG version 2 installed separately. Y
6565
err = store.AcquireLock(ctx)
6666
cancel()
6767
if err != nil {
68-
return NewExecError(ErrorApp, "Could not acquire a lock. Please make sure that no other instance of prvt is running with the same repo.", err)
68+
return NewExecError(ErrorApp, "Could not acquire a lock. Please make sure that no other instance of prvt is running with the same repo.\nIf you believe this is a mistake, you can forcefully break all locks with the \"prvt repo lock-break\" command.", err)
6969
}
7070
defer store.ReleaseLock(context.Background())
7171

cmd/repo-key-add.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ In order to use GPG keys, you need to have GPG version 2 installed separately. Y
6262
err = store.AcquireLock(ctx)
6363
cancel()
6464
if err != nil {
65-
return NewExecError(ErrorApp, "Could not acquire a lock. Please make sure that no other instance of prvt is running with the same repo.", err)
65+
return NewExecError(ErrorApp, "Could not acquire a lock. Please make sure that no other instance of prvt is running with the same repo.\nIf you believe this is a mistake, you can forcefully break all locks with the \"prvt repo lock-break\" command.", err)
6666
}
6767
defer store.ReleaseLock(context.Background())
6868

cmd/repo-key-rm.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ To identify a passphrase or a GPG key among those authorized, you can use the "p
6565
err = store.AcquireLock(ctx)
6666
cancel()
6767
if err != nil {
68-
return NewExecError(ErrorApp, "Could not acquire a lock. Please make sure that no other instance of prvt is running with the same repo.", err)
68+
return NewExecError(ErrorApp, "Could not acquire a lock. Please make sure that no other instance of prvt is running with the same repo.\nIf you believe this is a mistake, you can forcefully break all locks with the \"prvt repo lock-break\" command.", err)
6969
}
7070
defer store.ReleaseLock(context.Background())
7171

cmd/repo-lock-break.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ This command forcefully removes all locks placed on a repository, allowing the u
3838
3939
Most prvt commands acquire an exclusive lock on the repository before performing operations that would change the index, to forbid other instances of prvt from accessing the same repository and so to preserve the integrity of the data. Locks are generally removed automatically once the comamnd ends or the app is closed; however, in situations such as when the app suddenly crashes, repositories may remain in a locked state.
4040
41-
When that happens, using the "prvt repo break-locks --store <string>" command can help by removing all locks placed on a repository.
41+
When that happens, using the "prvt repo lock-break --store <string>" command can help by removing all locks placed on a repository.
4242
4343
This command should ONLY be invoked if you're sure that no other instance of prvt is accessing the data in the repository. Forcefully unlocking a repository that is in use by another instance of prvt could cause the index to be corrupted and data loss.
4444
`,

cmd/repo-upgrade.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Usage: "prvt repo upgrade --store <string>"
5555
err = store.AcquireLock(ctx)
5656
cancel()
5757
if err != nil {
58-
return NewExecError(ErrorApp, "Could not acquire a lock. Please make sure that no other instance of prvt is running with the same repo.", err)
58+
return NewExecError(ErrorApp, "Could not acquire a lock. Please make sure that no other instance of prvt is running with the same repo.\nIf you believe this is a mistake, you can forcefully break all locks with the \"prvt repo lock-break\" command.", err)
5959
}
6060
defer store.ReleaseLock(context.Background())
6161

cmd/rm.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ To remove a file, specify its exact path. To remove a folder recursively, specif
6666
err = store.AcquireLock(ctx)
6767
cancel()
6868
if err != nil {
69-
return NewExecError(ErrorApp, "Could not acquire a lock. Please make sure that no other instance of prvt is running with the same repo.", err)
69+
return NewExecError(ErrorApp, "Could not acquire a lock. Please make sure that no other instance of prvt is running with the same repo.\nIf you believe this is a mistake, you can forcefully break all locks with the \"prvt repo lock-break\" command.", err)
7070
}
7171
defer store.ReleaseLock(context.Background())
7272

cmd/serve.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ You can use the optional "--address" and "--port" flags to control what address
101101
err = store.AcquireLock(ctx)
102102
cancel()
103103
if err != nil {
104-
return NewExecError(ErrorApp, "Could not acquire a lock. Please make sure that no other instance of prvt is running with the same repo.", err)
104+
return NewExecError(ErrorApp, "Could not acquire a lock. Please make sure that no other instance of prvt is running with the same repo.\nIf you believe this is a mistake, you can forcefully break all locks with the \"prvt repo lock-break\" command.", err)
105105
}
106106

107107
// Request the info file

server/api-post-repo-select.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func (s *Server) PostRepoSelectHandler(c *gin.Context) {
8787
cancel()
8888
if err != nil {
8989
c.Error(err)
90-
c.AbortWithStatusJSON(http.StatusConflict, "Could not acquire a lock. Please make sure that no other instance of prvt is running with the same repo.")
90+
c.AbortWithStatusJSON(http.StatusConflict, "Could not acquire a lock. Please make sure that no other instance of prvt is running with the same repo.\nIf you believe this is a mistake, you can forcefully break all locks with the \"prvt repo lock-break\" command.")
9191
return
9292
}
9393

0 commit comments

Comments
 (0)