diff options
author | zeripath <art27@cantab.net> | 2022-10-11 09:35:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-11 16:35:29 +0800 |
commit | 1f804d35cad32eff16dbb5fedfff4ecac0fbf7a8 (patch) | |
tree | 3b19ce898b18107df6cbd42dc4fc4ed8c8b717c4 | |
parent | c83a05f114825f9b4d6341316f86cc13c2e4c4c6 (diff) | |
download | gitea-1f804d35cad32eff16dbb5fedfff4ecac0fbf7a8.tar.gz gitea-1f804d35cad32eff16dbb5fedfff4ecac0fbf7a8.zip |
Stop logging CheckPath returns error: context canceled (#21064) (#21405)
Backport #21064
We should only log CheckPath errors if they are not simply due to
context cancellation - and we should add a little more context to the
error message.
Fix #20709
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
-rw-r--r-- | modules/git/repo_attribute.go | 4 | ||||
-rw-r--r-- | services/gitdiff/gitdiff.go | 2 |
2 files changed, 2 insertions, 4 deletions
diff --git a/modules/git/repo_attribute.go b/modules/git/repo_attribute.go index 596a91e803..7d175f3de6 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 37dc0e114d..ec4cbd52d5 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) } } |