summaryrefslogtreecommitdiffstats
path: root/models/repo.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/repo.go')
-rw-r--r--models/repo.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/models/repo.go b/models/repo.go
index 08fbb0abea..b544853a5d 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -74,12 +74,12 @@ func DeleteRepository(doer *user_model.User, uid, repoID int64) error {
// Delete Deploy Keys
deployKeys, err := asymkey_model.ListDeployKeys(ctx, &asymkey_model.ListDeployKeysOptions{RepoID: repoID})
if err != nil {
- return fmt.Errorf("listDeployKeys: %v", err)
+ return fmt.Errorf("listDeployKeys: %w", err)
}
needRewriteKeysFile := len(deployKeys) > 0
for _, dKey := range deployKeys {
if err := DeleteDeployKey(ctx, doer, dKey.ID); err != nil {
- return fmt.Errorf("deleteDeployKeys: %v", err)
+ return fmt.Errorf("deleteDeployKeys: %w", err)
}
}
@@ -152,7 +152,7 @@ func DeleteRepository(doer *user_model.User, uid, repoID int64) error {
&repo_model.Watch{RepoID: repoID},
&webhook.Webhook{RepoID: repoID},
); err != nil {
- return fmt.Errorf("deleteBeans: %v", err)
+ return fmt.Errorf("deleteBeans: %w", err)
}
// Delete Labels and related objects
@@ -178,7 +178,7 @@ func DeleteRepository(doer *user_model.User, uid, repoID int64) error {
if repo.IsFork {
if _, err := db.Exec(ctx, "UPDATE `repository` SET num_forks=num_forks-1 WHERE id=?", repo.ForkID); err != nil {
- return fmt.Errorf("decrease fork count: %v", err)
+ return fmt.Errorf("decrease fork count: %w", err)
}
}
@@ -193,7 +193,7 @@ func DeleteRepository(doer *user_model.User, uid, repoID int64) error {
}
if err := project_model.DeleteProjectByRepoIDCtx(ctx, repoID); err != nil {
- return fmt.Errorf("unable to delete projects for repo[%d]: %v", repoID, err)
+ return fmt.Errorf("unable to delete projects for repo[%d]: %w", repoID, err)
}
// Remove LFS objects
@@ -310,7 +310,7 @@ func DeleteRepository(doer *user_model.User, uid, repoID int64) error {
if len(repo.Avatar) > 0 {
if err := storage.RepoAvatars.Delete(repo.CustomAvatarRelativePath()); err != nil {
- return fmt.Errorf("Failed to remove %s: %v", repo.Avatar, err)
+ return fmt.Errorf("Failed to remove %s: %w", repo.Avatar, err)
}
}
@@ -619,18 +619,18 @@ func DeleteDeployKey(ctx context.Context, doer *user_model.User, id int64) error
if asymkey_model.IsErrDeployKeyNotExist(err) {
return nil
}
- return fmt.Errorf("GetDeployKeyByID: %v", err)
+ return fmt.Errorf("GetDeployKeyByID: %w", err)
}
// Check if user has access to delete this key.
if !doer.IsAdmin {
repo, err := repo_model.GetRepositoryByIDCtx(ctx, key.RepoID)
if err != nil {
- return fmt.Errorf("GetRepositoryByID: %v", err)
+ return fmt.Errorf("GetRepositoryByID: %w", err)
}
has, err := access_model.IsUserRepoAdmin(ctx, repo, doer)
if err != nil {
- return fmt.Errorf("GetUserRepoPermission: %v", err)
+ return fmt.Errorf("GetUserRepoPermission: %w", err)
} else if !has {
return asymkey_model.ErrKeyAccessDenied{
UserID: doer.ID,
@@ -643,7 +643,7 @@ func DeleteDeployKey(ctx context.Context, doer *user_model.User, id int64) error
if _, err := db.DeleteByBean(ctx, &asymkey_model.DeployKey{
ID: key.ID,
}); err != nil {
- return fmt.Errorf("delete deploy key [%d]: %v", key.ID, err)
+ return fmt.Errorf("delete deploy key [%d]: %w", key.ID, err)
}
// Check if this is the last reference to same key content.