From 0e641aa30a2856b3ed256002eba5d6d7a086117d Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Fri, 10 Jan 2025 23:07:03 +0800 Subject: [PATCH] fix comment, ignore SetEditorconfigIfExists error --- routers/web/repo/middlewares.go | 12 +++--------- services/context/repo.go | 4 ++-- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/routers/web/repo/middlewares.go b/routers/web/repo/middlewares.go index 420931c5fb729..7518e6feae916 100644 --- a/routers/web/repo/middlewares.go +++ b/routers/web/repo/middlewares.go @@ -4,12 +4,9 @@ package repo import ( - "fmt" "strconv" - system_model "code.gitea.io/gitea/models/system" user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/optional" "code.gitea.io/gitea/services/context" user_service "code.gitea.io/gitea/services/user" @@ -22,12 +19,9 @@ func SetEditorconfigIfExists(ctx *context.Context) { } ec, _, err := ctx.Repo.GetEditorconfig() - - if err != nil && !git.IsErrNotExist(err) { - description := fmt.Sprintf("Error while getting .editorconfig file: %v", err) - if err := system_model.CreateRepositoryNotice(description); err != nil { - ctx.ServerError("ErrCreatingReporitoryNotice", err) - } + if err != nil { + // it used to check `!git.IsErrNotExist(err)` and create a system notice, but it is quite annoying and useless + // because network errors also happen frequently, so we just ignore it return } diff --git a/services/context/repo.go b/services/context/repo.go index 465c6e211cc79..121910235f1e8 100644 --- a/services/context/repo.go +++ b/services/context/repo.go @@ -204,11 +204,11 @@ func (r *Repository) GetCommitGraphsCount(ctx context.Context, hidePRRefs bool, }) } -// RefTypeNameSubURL sub-url for the BranchName field, for example: +// RefTypeNameSubURL makes a sub-url for the current ref (branch/tag/commit) field, for example: // * "branch/master" // * "tag/v1.0.0" // * "commit/123456" -// It is usually used to construct a link for lie ".../src/{RefTypeNameSubURL}/{TreePath}" +// It is usually used to construct a link like ".../src/{{RefTypeNameSubURL}}/{{PathEscapeSegments TreePath}}" func (r *Repository) RefTypeNameSubURL() string { switch { case r.IsViewBranch: