diff --git a/modules/git/repo_attribute.go b/modules/git/repo_attribute.go index 596a91e80382a..7d175f3de6215 100644 --- a/modules/git/repo_attribute.go +++ b/modules/git/repo_attribute.go @@ -191,8 +191,8 @@ func (c *CheckAttributeReader) Run() error { // CheckPath check attr for given path func (c *CheckAttributeReader) CheckPath(path string) (rs map[string]string, err error) { defer func() { - if err != nil { - log.Error("CheckPath returns error: %v", err) + if err != nil && err != c.ctx.Err() { + log.Error("Unexpected error when checking path %s in %s. Error: %v", path, c.Repo.Path, err) } }() diff --git a/services/gitdiff/gitdiff.go b/services/gitdiff/gitdiff.go index 37dc0e114dac7..ec4cbd52d56a9 100644 --- a/services/gitdiff/gitdiff.go +++ b/services/gitdiff/gitdiff.go @@ -1448,8 +1448,6 @@ func GetDiff(gitRepo *git.Repository, opts *DiffOptions, files ...string) (*Diff } else if language, has := attrs["gitlab-language"]; has && language != "unspecified" && language != "" { diffFile.Language = language } - } else { - log.Error("Unexpected error: %v", err) } }