Skip to content

Commit

Permalink
fix comment, ignore SetEditorconfigIfExists error
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang committed Jan 10, 2025
1 parent bc61be3 commit 0e641aa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
12 changes: 3 additions & 9 deletions routers/web/repo/middlewares.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions services/context/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 0e641aa

Please sign in to comment.